From dee095c25e05880ca0e9d2c3bd0eda066aad5ca4 Mon Sep 17 00:00:00 2001 From: Nanda Lopes Date: Mon, 16 Nov 2020 13:12:35 -0300 Subject: [PATCH] Fix C- tmux error `.tmux.conf:33: unknown key: C- if-shell` --- tmux/tmux.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 38b77764..8ab3ea1a 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -27,7 +27,12 @@ bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" -bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" + +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'" # Use vi keybindings for tmux commandline input. # Note that to get command mode you need to hit ESC twice...