tmux / tmux

tmux source code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to bind shortcuts like C-S-[letter]

dridi opened this issue · comments

I'm not a long time tmux user. I started in February and although I still have a couple things bothering me today compared to terminator. Despite my peeves it's my daily driver, paired with tmuxinator. Today I'm opening this issue after getting rid of a couple other annoyances that only required a good round of RTFM.

Some details:

My problem is that I'd like to bind shortcuts using Ctrl+Shift but it doesn't work with letters. Before opening this issue I searched through the existing ones and could only find [1] a scary comment. Things are not boding well.

In tmux, the shortcut seems to be created but treated differently when it's a letter:

$ tmux lsk | grep [CS]-[CS]
bind-key    -T root   S-C-e            split-window -h
bind-key    -T root   S-C-o            split-window
bind-key    -T root   S-C-x            resize-pane -Z
bind-key    -T root   C-S-Up           resize-pane -U
bind-key    -T root   C-S-Down         resize-pane -D
bind-key    -T root   C-S-Left         resize-pane -L
bind-key    -T root   C-S-Right        resize-pane -R

Working shortcuts are bound as C-S-*, broken ones as S-C-*, could it be a hint? You may recognize terminator's shortcuts that I've been missing for months :)

The reason to bind those shortcuts is mostly to avoid having panes management in tmux conflicting with what's running inside the panes. If there is really no way to bind C-S-e and others, there should be an error message when trying to do that, and if that's the case I will keep my fallback using M+e and others.

Thanks!

[1] #309 (comment)

The control modifier works by masking the value of the character with 0x1F; i.e., it returns just the low five bits of the value normally sent by the character. Take a look at man ascii. Notice that lower case "a" has value 0x61 and upper case "A" has value 0x41. Written in binary that is 0b01100001 and 0b01000001. So the control transformation returns 0b00000001 for each letter. Which means [ctrl-a] and [ctrl-A] both send the SOH, 0x01, character. You can't distinguish whether a lower or upper case "a" was used.

Thanks for the sad confirmation. In this case, as I said above, I would expect an error message when trying to do that.

A command like tmux bind-key -n C-S-o split-window should fail, and I should not find a bogus key binding afterwards with tmux lsk.

commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.