Question

When I run Vim inside Tmux, I have to press the tab key two times to get the keypress registered. I googled around for a while, to no avail, and I don't h ave this problem when I use Vim outside of Tmux. Is the tab key reserved for something I'm not aware of?

How do I fix this?

Was it helpful?

Solution

I haven't really configured anything in tmux besides remapping C-b to C-i.

set -g prefix C-i
unbind C-b
bind C-i send-prefix

While Tab and the Control-i are usually distinguished in GUI environment, they generate the same character in tty-based environments like terminal emulators. That character is U+0009, which is the Tab control character. It is represented as the single byte 0x09 in ASCII, UTF-8 and many other encodings. All of the “C0 control codes” (ASCII 0-31) have keyboard equivalents that combine the Control key with another key (mostly letters, but also some symbols). The Tab control character is generated by Control-i.

You can verify that (at least) tmux considers C-i and Tab to be the same by looking at the output of tmux show-options -g | grep prefix. You will see it has set your prefix to the key named Tab, even though you specified it as C-i in your configuration. You can also notice the same canonicalization in the output of tmux list-keys | grep prefix.

You may want to pick a different prefix if you do not want to type Tab twice when you want to send one to programs running inside tmux.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top