tmux nav and statusbar fixes

This commit is contained in:
Andrei Stoica 2024-02-03 18:11:25 -05:00
parent 5a4dd97777
commit caf3c2a681
1 changed files with 24 additions and 7 deletions

View File

@ -44,11 +44,25 @@ set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# navigation
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
bind-key -r h select-pane -L
# 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|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n -r 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n -r 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n -r 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n -r '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
# resize
bind-key -r -T prefix M-k resize-pane -U
@ -56,6 +70,9 @@ bind-key -r -T prefix M-j resize-pane -D
bind-key -r -T prefix M-h resize-pane -L
bind-key -r -T prefix M-l resize-pane -R
bind C-l send-keys 'C-l'
bind C-\\ send-keys 'C-\'
set-option -g allow-passthrough on
set -g default-terminal "xterm-256color"
@ -65,6 +82,6 @@ set -g status-left-length 85
set -g status-left "#[bg=black]working on#[fg=colour135] #S #[bg=default fg=black]"
set -g window-status-current-format "#[fg=colour135]#W"
set -g status-style bg=default
set -g pane-active-border-style fgkcolour135
#set -g status-justify centre
set -g pane-active-border-style fg=colour135
set -g status-justify centre