3

I've been using (prefixed) o to zoom the current tmux pane, and Space to zoom the neighboring pane:

bind o      resize-pane -Z
bind Space  if-shell -F '#{window_zoomed_flag}' 'last-pane' 'select-pane -t :.+; resize-pane -Z'

I want to change these to use Space and Shift-Space instead.

bind Space    resize-pane -Z
bind S-Space  if-shell -F '#{window_zoomed_flag}' 'last-pane' 'select-pane -t :.+; resize-pane -Z'

I restarted my tmux server and ran tmux list-keys. The new bindings are listed, and the first binding works as expected, but I'm having trouble passing S-Space through to tmux for the second binding.

Using iTerm (I'm on OSX) with its default settings, ⇧ShiftSpace ignores the ⇧Shift modifier, so when I type <prefix> S-Space, tmux just receives <prefix> Space.

I actually configure iTerm to send escape sequence ^[[32;2u for ⇧ShiftSpace so I can use it for Vim key-mappings. With this setting active, typing <prefix> S-Space in tmux inserts 32;2u on the command line.

I tried to debug using cat -v inside tmux:

^[[32;2u    # S-Space
32;2u       # <prefix> S-Space

Is there a different escape sequence that tmux would recognize as S-Space, or some other way to make it work?

I read a bit about tmux's terminal-overrides setting, but that sounds like it's only for control sequences. I use C-a as my prefix key, if that's relevant.

1 Answer 1

3

short: no

long: unless you have changed your keyboard mapping, shift+space will send just space.

Aside from a few other special keys (Enter), you might expect shift to modify the character(s) sent by the keyboard. This is not always the case. Most of the ones you are familiar with are based on xterm, e.g., using shift, control and alt (or meta) to generate different escape sequences.

tmux "knows" about the xterm keys (and has a mode which can be set to permit it to use those keys). Otherwise (if xterm-keys is not set), if the key matches the terminal description for one of the known special keys (function- and cursor- and editing-keys such as Home and End), tmux accepts that key (and maps it into the screen or whatever "internal" terminal description is used).

If the key does not fall into one of those categories, tmux ignores it (discards it).

So... if you want to use shiftspace, you will have to make it send one of the escape sequences which tmux expects, and make your binding against the corresponding predefined capability.

Further reading:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .