♻️ Script/dot working again!

This commit is contained in:
Marley Rae 2024-01-28 11:55:11 -08:00
parent 05f5b26907
commit 7df0ba752b
5 changed files with 55 additions and 18 deletions

View file

@ -2,7 +2,9 @@
# Remove that annoying 'last logged in' message. # Remove that annoying 'last logged in' message.
# Tested this method vs in iTerm settings - latter is less portable and slower. # Tested this method vs in iTerm settings - latter is less portable and slower.
printf '\33c\e[3J' if status is-login
printf '\33c\e[3J'
end
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

33
script/dot Normal file → Executable file
View file

@ -25,9 +25,6 @@ function link_file
set -f src $argv[1] set -f src $argv[1]
set -f dst $argv[2] set -f dst $argv[2]
set -f overwrite false
set -f backup false
set -f skip false
set -f action set -f action
if [ -f "$dst" ] || [ -d "$dst" ] || [ -L "$dst" ] if [ -f "$dst" ] || [ -d "$dst" ] || [ -L "$dst" ]
@ -36,24 +33,25 @@ function link_file
set -f current_src (readlink "$dst") set -f current_src (readlink "$dst")
if [ "$current_src" = "$src" ] if [ "$current_src" = "$src" ]
set skip true set -f skip true
else else
print_question "File already exists: $dst ($(basename $src)), what do you want to do?\n([s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all)" print_question "File already exists: $dst ($(basename $src)), what do you want to do?"
print_question "([s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all)"
read -n 1 action read -n 1 action
switch $action switch $action
case o case o
set overwrite true set -f overwrite true
case O case O
set overwrite_all true set -f overwrite_all true
case b case b
set backup true set -f backup true
case B case B
set backup_all true set -f backup_all true
case s case s
set skip true set -f skip true
case S case S
set skip_all true set -f skip_all true
end end
end end
end end
@ -83,17 +81,17 @@ function link_file
mkdir -p (string replace -r '\/[^\/]+$' '' "$dst") mkdir -p (string replace -r '\/[^\/]+$' '' "$dst")
end end
ln -s "$src" "$dst" ln -s "$src" "$dst" &> /dev/null
print_success "Linked $src to $dst" print_success "Linked $src to $dst"
end end
end end
function make_dst function make_dst
set -l path (string escape --style=regex "$DOT") set -l path (string replace -a '/' '\/' "$DOT")
set -l regex (string join '^\/' $path '\/[a-zA-Z]+\/(.+)\.symlink$') set -l regex (string join '' '^' "$path" '\/[a-zA-Z]+\/(.+)\.symlink$')
set -l dst (string replace -r $regex '$1' "$argv[1]") set -l dst (string replace -r $regex '$1' "$argv[1]")
printf '%s' "$dst" printf '%s' "$HOME/$dst"
end end
function install_dotfiles function install_dotfiles
@ -103,8 +101,9 @@ function install_dotfiles
set -g backup_all false set -g backup_all false
set -g skip_all false set -g skip_all false
find -H "$DOT" -name "*.symlink" -not -path ".git" | \ for src in (find -H "$DOT" -name "*.symlink" -not -path ".git")
while read -l -t src; link_file "$src" "$(make_dst $src)"; end link_file $src (make_dst $src)
end
end end
################################################################################ ################################################################################

0
script/utils Normal file → Executable file
View file

34
tmux/.tmux.conf.symlink Normal file
View file

@ -0,0 +1,34 @@
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'catppuccin/tmux'
set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_window_left_separator ""
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_middle_separator " █"
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_default_fill "number"
set -g @catppuccin_window_default_text "#W"
set -g @catppuccin_window_current_fill "number"
set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "directory user host session"
set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
# Install tpm if not already installed.
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Init tmux plugin manager.
# Must be very last line!!
run '~/.tmux/plugins/tpm/tpm'

2
tmux/install.fish Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env fish