6

I am having lots of issues with tmux on Mac.

One problem I have is that I cannot bind a key in my tmux.conf to resize my panes.

What I need is the CTRL-b: resize-pane -U 10 I currently do to increase the size of the pane upwards ten cells (or downwards or left or right) to be done by a key shortcut and not to actually have to type this over and over (which I currently do unfortunately).

But I can not find a way to configure this since on Mac, it seems that CTRL and other keys work diffently than on Linux.

Can anyone please help me out?

5

In ~/.tmux.conf:

bind e resize-pane -U 10

Then, tmux source-file ~/.tmux.conf. (another useful shortcut: use the same principle).

  • 1
    1) So bind e resize-pane -U 10 is one line in tmux that binds the key e with the resize? Should I have pressed the ctrl-b before e? 2) I am not sure what you mean with tmux source-file ~/.tmux.conf. Doesn't tmux read the home directory's conf file? – Jim Jul 4 '13 at 19:43
  • @Jim: Yes, you hit the prefix key first. Then e. Yes, tmux does that, but it is faster to have it as a shortcut as well, so you don't have to restart tmux every time you make an improvement/extension in/to the init file. – Emanuel Berg Jul 4 '13 at 19:44
  • So tmux source-file ~/.tmux.conf is another line in tmux.conf? – Jim Jul 4 '13 at 19:46
  • @Jim: No, that would be something you type. In the init file, it could look like this: bind u source-file ~/.tmux.conf if you want this for u. – Emanuel Berg Jul 4 '13 at 19:50
  • 1
    why are you using bind and not bind-key? – Charlie Parker Jan 28 '16 at 22:04
4

Below are my keybindings that let me resize a pane.

It uses Alt + direction, where the keys for the directions are known from Vim:

  k
h l 
  j
# Resize the current pane using Alt + direction
bind -n M-k resize-pane -U 5
bind -n M-j resize-pane -D 5
bind -n M-h resize-pane -L 5
bind -n M-l resize-pane -R 5

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.