feat(tmux): tmux-ssher wip
This commit is contained in:
parent
791500431a
commit
fc639f1fe4
|
@ -28,6 +28,7 @@ tmux/*
|
|||
!tmux/tmux.conf
|
||||
!tmux/tmux-sessionizer
|
||||
!tmux/tmux-ggclone
|
||||
!tmux/tmux-ssher
|
||||
|
||||
# git
|
||||
!git
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected=$1
|
||||
else
|
||||
selected=$(grep "Host .*" ~/.ssh/config | grep -v "*" | sed "s/Host \(.*\)/\1/" | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down')
|
||||
fi
|
||||
|
||||
if [[ -z $selected ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
selected_name="ssh_$selected"
|
||||
tmux_running=$(pgrep tmux)
|
||||
|
||||
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||
tmux new-session -s $selected_name -c $selected ssh "$selected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
||||
tmux new-session -ds $selected_name -c $selected ssh "$selected"
|
||||
fi
|
||||
|
||||
tmux switch-client -t $selected_name
|
|
@ -34,11 +34,8 @@ bind -r j select-pane -D
|
|||
bind -r h select-pane -L
|
||||
bind -r l select-pane -R
|
||||
|
||||
bind -r D neww -c "#{pane_current_path}" "nvim TODO.md"
|
||||
bind -r t neww -c "~" "nvim ~/.TODO.md"
|
||||
|
||||
bind-key -r f run-shell "tmux neww ~/.config/tmux/tmux-sessionizer"
|
||||
bind-key -r g run-shell "tmux neww ~/.config/tmux/tmux-sessionizer $XDG_CONFIG_HOME"
|
||||
bind-key -r F run-shell "tmux neww ~/.config/tmux/tmux-ssher"
|
||||
bind-key -r T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp"
|
||||
bind-key -r R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~"
|
||||
bind-key -r G run-shell "tmux neww ~/.config/tmux/tmux-ggclone"
|
||||
|
|
Loading…
Reference in New Issue