Update tmux conf to work with fzf and nvim

This commit is contained in:
Christoffer Martinsson 2023-07-06 13:10:22 +02:00
parent 354c158084
commit 8af69312b1

View File

@ -9,6 +9,15 @@ if "test ! -d ~/.tmux/plugins/tpm" \
# Activate the plugins.
run -b "~/.tmux/plugins/tpm/tpm"
# VIM and FZF navigation bindings
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
bind -n C-h run "($is_vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "($is_vim && tmux send-keys C-j) || ($is_fzf && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "($is_vim && tmux send-keys C-k) || ($is_fzf && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "($is_vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n 'C-\' if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
set-option -g status-position bottom
set-option -g default-terminal "screen-256color"
set-option -sa terminal-features ',xterm-256color:RGB'