♻️ Script/dot working again!
This commit is contained in:
parent
05f5b26907
commit
7df0ba752b
5 changed files with 55 additions and 18 deletions
|
@ -2,7 +2,9 @@
|
|||
|
||||
# Remove that annoying 'last logged in' message.
|
||||
# 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
33
script/dot
Normal file → Executable file
|
@ -25,9 +25,6 @@ function link_file
|
|||
set -f src $argv[1]
|
||||
set -f dst $argv[2]
|
||||
|
||||
set -f overwrite false
|
||||
set -f backup false
|
||||
set -f skip false
|
||||
set -f action
|
||||
|
||||
if [ -f "$dst" ] || [ -d "$dst" ] || [ -L "$dst" ]
|
||||
|
@ -36,24 +33,25 @@ function link_file
|
|||
set -f current_src (readlink "$dst")
|
||||
|
||||
if [ "$current_src" = "$src" ]
|
||||
set skip true
|
||||
set -f skip true
|
||||
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
|
||||
|
||||
switch $action
|
||||
case o
|
||||
set overwrite true
|
||||
set -f overwrite true
|
||||
case O
|
||||
set overwrite_all true
|
||||
set -f overwrite_all true
|
||||
case b
|
||||
set backup true
|
||||
set -f backup true
|
||||
case B
|
||||
set backup_all true
|
||||
set -f backup_all true
|
||||
case s
|
||||
set skip true
|
||||
set -f skip true
|
||||
case S
|
||||
set skip_all true
|
||||
set -f skip_all true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -83,17 +81,17 @@ function link_file
|
|||
mkdir -p (string replace -r '\/[^\/]+$' '' "$dst")
|
||||
end
|
||||
|
||||
ln -s "$src" "$dst"
|
||||
ln -s "$src" "$dst" &> /dev/null
|
||||
print_success "Linked $src to $dst"
|
||||
end
|
||||
end
|
||||
|
||||
function make_dst
|
||||
set -l path (string escape --style=regex "$DOT")
|
||||
set -l regex (string join '^\/' $path '\/[a-zA-Z]+\/(.+)\.symlink$')
|
||||
set -l path (string replace -a '/' '\/' "$DOT")
|
||||
set -l regex (string join '' '^' "$path" '\/[a-zA-Z]+\/(.+)\.symlink$')
|
||||
set -l dst (string replace -r $regex '$1' "$argv[1]")
|
||||
|
||||
printf '%s' "$dst"
|
||||
printf '%s' "$HOME/$dst"
|
||||
end
|
||||
|
||||
function install_dotfiles
|
||||
|
@ -103,8 +101,9 @@ function install_dotfiles
|
|||
set -g backup_all false
|
||||
set -g skip_all false
|
||||
|
||||
find -H "$DOT" -name "*.symlink" -not -path ".git" | \
|
||||
while read -l -t src; link_file "$src" "$(make_dst $src)"; end
|
||||
for src in (find -H "$DOT" -name "*.symlink" -not -path ".git")
|
||||
link_file $src (make_dst $src)
|
||||
end
|
||||
end
|
||||
|
||||
################################################################################
|
||||
|
|
0
script/utils
Normal file → Executable file
0
script/utils
Normal file → Executable file
34
tmux/.tmux.conf.symlink
Normal file
34
tmux/.tmux.conf.symlink
Normal 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
2
tmux/install.fish
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env fish
|
||||
|
Loading…
Reference in a new issue