10

Tmux allows one to move through panes using Ctrl-b + (→, ←, ↑, ↓).

I would like to remap this to:

Ctrl-b + Ctrl-(l, j, i, k).

For reference, the layout of the keys l,j,i,k is similar to that of the arrow keys, but they are easier to type without moving the hand.

I have been editing a few things here and there on the .tmux.conf, but I could not find information on how to rebind the above commands.

  • 4
    man tmux | less -p select-pane – jasonwryan Mar 3 '13 at 19:46
13

tmux list-keys (or prefix + ? in dfault settings) will give you current key mappings in the form of commands needed to set them up. See man tmux, the command name is bind-key (and you might want to remove the default bindings with unbind-key).

You might also want to consider more "standard" combination hjkl, known from vi and clones (all keys in the home row), especially if you are a fast typist.

7

If you want to stick to vim-like navigation, would be useful to remap the resize-pane also:

# vim-like pane resizing  
bind -r C-k resize-pane -U
bind -r C-j resize-pane -D
bind -r C-h resize-pane -L
bind -r C-l resize-pane -R

# vim-like pane switching
bind -r k select-pane -U 
bind -r j select-pane -D 
bind -r h select-pane -L 
bind -r l select-pane -R 

# and now unbind keys
unbind Up     
unbind Down   
unbind Left   
unbind Right  

unbind C-Up   
unbind C-Down 
unbind C-Left 
unbind C-Right

I'll show you my .tmux.conf as a reference

And by the way, don't forget to remap the 'horizontal-split' in case you have it on the h key as it will interfere with your pane-resize and pane-switch.

  • 3
    Just a note: the "-r" allows you to do PREFIX then hit several times the command bound: for example: CTRL-B CTRL-J CTRL-J CTRL-J will extend the current pane by 3 lines instead of: CTRL-B CTRL-J CTRL-B CTRL-J CTRL-B CTRL-J – gbin Nov 29 '16 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.