How to resize tmux panes inside tty

3

I'm not sure if I used the right term, but by "tty" I understand the console that you can switch to using ctrl+alt+f2 key combination. echo $TERM points to linux. Anyway, when I enter the tmux mode I can make several panes. I can also switch between them without problems but I can't resize them. I'm able to do so in the graphic mode (X11) by pressing ctl+a (tmux prefix) and then ctrl + ,,, arrows.

Does anyone know how to do the same under the tty console?

Mikhail Morfikov

Posted 2013-12-15T20:02:53.177

Reputation: 781

1They're both terminals. The former is a virtual terminal (sometimes also called a virtual console) and the latter (employed by a program such as xterm, konsole, lxterminal, or gnome-terminal) is a pseudo-terminal. Help the answerers and edit your question with the value of the TERM environment variable in the respective shells (before you invoke tmux). – JdeBP – 2013-12-16T14:27:43.107

Answers

3

I asked this question also on tmux mailing list, and I got the following answer:

When you press a non-text key or key-sequence, your terminal translates that into some particular sequence of characters. For example, if I open a new gnome-terminal, run "cat" and press keys, I can see that left-arrow sends "^[[D", while ctrl+left-arrow sends "^[[1;5D".

I believe the ability to send modifiers (ctrl, alt, shift) with arrow-keys is a feature added by xterm and copied by other terminal-emulators, it's not part of the original VT100/VT220 feature-set. Which is to say, if you run "cat" in a terminal and pressing ctrl+left-arrow results in "^[[D" on your screen, then you're out of luck.

In particular, the Linux console is a very limited and not-particularly-xterm-compatible terminal, and it doesn't surprise me that it doesn't support ctrl+arrow keys.

So, the only way to resize panes under tty is to rebind keys:

bind-key -r < resize-pane -L 3
bind-key -r > resize-pane -R 3
bind-key -r + resize-pane -U 1
bind-key -r = resize-pane -D 1

Mikhail Morfikov

Posted 2013-12-15T20:02:53.177

Reputation: 781

1Using equal sign may not be recommended, as it does have a default action ("choose-buffer") in my version of tmux (OpenBSD 5.0). Use Ctrl-B an dthen ? to see what is bound, and choose something unused. For quicker testing, you don't really need to bind. You can just use Ctrl-B, then colon, then "resizep -D" (to move down one), or similar variations (Ctrl-B, then ":resizep -L 3") would move Left three. Slower in the long term, but quicker instant success/test. "-U 1" specifies two options that are both default. – TOOGAM – 2015-01-12T01:33:24.117