# HG changeset patch # User Zeger Van de Vannet # Date 1612459737 -3600 # Node ID f220567b278ec12cd6713222d5a8822ba3d1373c # Parent a128f9c0f02e66a21881178e335b0b95f0d4d0aa Update tmux-vim mapping diff -r a128f9c0f02e -r f220567b278e dot_tmux.conf --- a/dot_tmux.conf Fri Feb 05 14:58:49 2021 +0100 +++ b/dot_tmux.conf Thu Feb 04 18:28:57 2021 +0100 @@ -2,13 +2,13 @@ # Nested TMUX sessions (from # https://medium.freecodecamp.org/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795) -bind -T root F12 \ +bind -T root F11 \ set prefix None \;\ set key-table off \;\ set status-right "#[fg=colour0,bg=colour1] DISABLED #[fg=colour3,bg=colour0] #{session_name}#[fg=colour1] | #[fg=colour2]%d %b %l:%M %p " refresh-client -S \;\ -bind -T off F12 \ +bind -T off F11 \ set -u prefix \;\ set -u key-table \;\ set -u status-right \;\ @@ -35,8 +35,8 @@ set -g status-justify "left" set -g status-bg "colour0" set -g status-fg "colour7" -set -g message-bg "colour0" -set -g message-fg "colour8" +# set -g message-bg "colour0" +# set -g message-fg "colour8" setw -g window-status-bell-style "fg=colour0,bg=colour5" @@ -67,16 +67,21 @@ # See: https://github.com/christoomey/vim-tmux-navigator is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" -bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" -bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" -bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" -bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" -bind-key -T copy-mode-vi C-h select-pane -L -bind-key -T copy-mode-vi C-j select-pane -D -bind-key -T copy-mode-vi C-k select-pane -U -bind-key -T copy-mode-vi C-l select-pane -R -bind-key -T copy-mode-vi C-\ select-pane -l +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l #act like GNU screen unbind C-b set -g prefix C-Space