2

If you have an American English keyboard, pressing Ctrl-[ (control plus left square bracket) is equivalent to pressing Esc. This provides an easy way to exit from insert mode.

source: https://vim.fandom.com/wiki/Avoid_the_escape_key

So I just learned this after spending the last 3 months full time going nuts over why pressing escape double for me activated some function that I didn't want. Because obviously double escape should not be different from single escape.

So turns out I have the Ctrl-[ key in use... Which turns out is something poisoned.

Yeah so I'm gonna keep myself civil and not ask why on earth this is a thing, but just kindly ask if there is a way to turn that "feature" off?

5

Vim is a terminal based program and has its key handling from the terminal. Also the GUI variants still act like this (with a few extensions).

In a terminal Ctrl-A is ASCII 0x01, Ctrl-B is ASCII 0x02 and so on. Ctrl-Z is 0x1A and Ctrl-[ is 0x1B.

And 0x1B is also the ASCII code for ESC.

Vim can't differentiate between ESC and Ctrl-[, because it gets the same key code when either is pressed.

For the same reason it can't differentiate between Ctrl-I and <TAB>. Both produce 0x09.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.