added tmux and nvim integration for pane switching

This commit is contained in:
Christopher Beckmann
2023-10-14 15:16:37 +02:00
parent 22e741c30c
commit 1497c7967c
3 changed files with 17 additions and 7 deletions

View File

@@ -22,11 +22,12 @@ set -g history-limit 50000
# reload config
bind C-r source-file ${XDG_CONFIG_HOME}/tmux/tmux.conf \; display "Config reloaded!"
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# switch panes using Alt-arrow without prefix - detect when we are in vim and switch panes there instead
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
bind -n M-Left if-shell "$is_vim" 'send-keys M-Left' 'select-pane -L'
bind -n M-Right if-shell "$is_vim" 'send-keys M-Right' 'select-pane -R'
bind -n M-Up if-shell "$is_vim" 'send-keys M-Up' 'select-pane -U'
bind -n M-Down if-shell "$is_vim" 'send-keys M-Down' 'select-pane -D'
# vim style switch pane
bind h select-pane -L