From ffc8945630bf7d638d2f22ef7e800aaa5603be24 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 13 Aug 2024 09:11:06 +0100 Subject: [PATCH] Simplify tmux configuration --- lib/shared/modules/tmux.nix | 39 +++---------------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/lib/shared/modules/tmux.nix b/lib/shared/modules/tmux.nix index db098b3..bbfc1c2 100644 --- a/lib/shared/modules/tmux.nix +++ b/lib/shared/modules/tmux.nix @@ -9,22 +9,9 @@ in terminal = "tmux-256color"; extraConfig = '' - unbind C-b - - set -g prefix ` - bind ` send-prefix - - bind-key -n C-h select-pane -L - bind-key -n C-j select-pane -D - bind-key -n C-k select-pane -U - bind-key -n C-l select-pane -R - - set-option -g status-keys "emacs" + set-option -g status-keys "vi" set-option -sa terminal-features "''${TERM}:RGB" - bind-key h split-window -v -c "#{pane_current_path}" - bind-key v split-window -h -c "#{pane_current_path}" - bind -n S-Left resize-pane -L 2 bind -n S-Right resize-pane -R 2 bind -n S-Down resize-pane -D 1 @@ -48,6 +35,7 @@ in bind c new-window -c "#{pane_current_path}" set -g base-index 1 + set -g pane-base-index 1 set -g renumber-windows on # Break a pane into a new window. @@ -80,30 +68,9 @@ in set-option -g pane-active-border-style "fg=#1f2335" set-option -g pane-border-style "fg=#1f2335" - # Smart pane switching with awareness of Vim splits. - # 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 -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 -r F new-window t - bind-key -r D run-shell "t $REPOS/dotfiles.nix" - bind-key -r N run-shell "t $REPOS/opdavies.nvim" - bind-key -r W run-shell "t ~/Documents/wiki" + bind-key -r f run-shell "tmux new-window t" set -g @resurrect-strategy-nvim 'session' - - if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local' ''; plugins = [