From aa473e3ecbfbcd6f2a7feb17d573b3547a3f5402 Mon Sep 17 00:00:00 2001 From: Bas van den Wollenberg Date: Tue, 5 Mar 2024 22:57:32 +0100 Subject: [PATCH] Use plugin for tmux.nvim instead of custom keybinds --- tmux/.tmux.conf | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index ded5311..d2bd3d8 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -14,31 +14,6 @@ set -s escape-time 0 # start window index at 1 set -g base-index 1 -# what in the regex -is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" - -# vim-like pane navigation (and tmux.nvim integration) -bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L' -bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D' -bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U' -bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R' - -bind-key -T copy-mode-vi 'M-h' select-pane -L -bind-key -T copy-mode-vi 'M-j' select-pane -D -bind-key -T copy-mode-vi 'M-k' select-pane -U -bind-key -T copy-mode-vi 'M-l' select-pane -R - -# resize bindings -bind -n 'M-H' if-shell "$is_vim" 'send-keys M-H' 'resize-pane -L 5' -bind -n 'M-J' if-shell "$is_vim" 'send-keys M-J' 'resize-pane -D 5' -bind -n 'M-K' if-shell "$is_vim" 'send-keys M-K' 'resize-pane -U 5' -bind -n 'M-L' if-shell "$is_vim" 'send-keys M-L' 'resize-pane -R 5' - -bind-key -T copy-mode-vi M-H resize-pane -L 5 -bind-key -T copy-mode-vi M-J resize-pane -D 5 -bind-key -T copy-mode-vi M-K resize-pane -U 5 -bind-key -T copy-mode-vi M-L resize-pane -R 5 - # quicker navigation bind C-n next-window bind C-p previous-window @@ -72,6 +47,25 @@ set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'nordtheme/tmux' set -g @nord_tmux_show_status_content '0' +set -g @plugin 'aserowy/tmux.nvim' + +# navigation +set -g @tmux-nvim-navigation true +set -g @tmux-nvim-navigation-cycle true +set -g @tmux-nvim-navigation-keybinding-left 'M-h' +set -g @tmux-nvim-navigation-keybinding-down 'M-j' +set -g @tmux-nvim-navigation-keybinding-up 'M-k' +set -g @tmux-nvim-navigation-keybinding-right 'M-l' + +# resize +set -g @tmux-nvim-resize true +set -g @tmux-nvim-resize-step-x 5 +set -g @tmux-nvim-resize-step-y 5 +set -g @tmux-nvim-resize-keybinding-left 'M-H' +set -g @tmux-nvim-resize-keybinding-down 'M-J' +set -g @tmux-nvim-resize-keybinding-up 'M-K' +set -g @tmux-nvim-resize-keybinding-right 'M-L' + if "test ! -d ~/.tmux/plugins/tpm" \ "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'" run "~/.tmux/plugins/tpm/tpm" -- 2.54.0