s1n7ax
s1n7ax

Reputation: 3069

How to find what vim default key binds does?

Apparently <c-space> doing something by default in vim but I can't figure out a way to check what it's doing.

:imap <c-space>
> No mapping found

:h <c-space>
> Sorry, no help for <c-space>

Upvotes: 2

Views: 1540

Answers (1)

filbranden
filbranden

Reputation: 8908

It's a little hard to give a fully generic answer here and sometimes your specific platform or terminal emulator might have an effect on how specific keys are seen by Vim.

One way to try to figure out which key code is seen by Vim is to go into Insert mode and then press Ctrl+V followed by your specific key. (See :help i_CTRL-V, which will tell you Vim will insert the next symbol literally.)

In my case, typing Ctrl+V followed by Ctrl+Space in Insert mode shows me ^@, which symbolizes the Ctrl+@ sequence, which shows me that's how Vim is seeing this key sequence.

(I believe this is mostly universal, and Ctrl+Space will always generate Ctrl+@ everywhere, but as I mentioned there are platform differences, so I can't guarantee it works that way everywhere, but you should be able to use the same Ctrl+V trick to find out if it's the same or not in your case.)

Following that finding, you can then look at :help i_CTRL-@ to see that the Ctrl+@ sequence (which should be equivalent to Ctrl+Space) will "insert previously inserted text and stop insert."

Upvotes: 4

Related Questions