tmux: Remap h, j, k, l to j, k, l, ; in choose-tree mode

Viewed 90

Is it possible to remap hjkl keys in choose-tree mode?

I tried the following:

unbind -T choose-tree h;
unbind -T choose-tree j;
unbind -T choose-tree k;
unbind -T choose-tree l;

bind -T choose-tree j send-keys -X collapse-selected-item;
bind -T choose-tree k send-keys -X select-next-item;
bind -T choose-tree l send-keys -X select-previous-item;
bind -T choose-tree \; send-keys -X expand-selected-item;

But I got an error: table choose-tree doesn't exist.

I also tried replace choose-tree with choose-mode but it also didn't work.

1 Answers

Add this to your config file.

bind-key -T root  j if -F "#{==:#{pane_mode},tree-mode}" "send h" "send j"
bind-key -T root  k if -F "#{==:#{pane_mode},tree-mode}" "send j" "send k"
bind-key -T root  l if -F "#{==:#{pane_mode},tree-mode}" "send k" "send l"
bind-key -T root \; if -F "#{==:#{pane_mode},tree-mode}" "send l" "send \;"

Reference: Is it possible to remap key bindings in choose-tree mode? : tmux

Related