2

When I enter insert mode and type <C-SPACE>, vim inserts the last inserted text, then exits insert mode. My guess is it's using the ". register.

<C-V><C-SPACE> prints a null character. However when I enter the command :imap, it doesn't list any mappings. I was expecting there to be a mapping for the null character.

Can someone explain this behavior?

  • <C-Space> just puts a space for me even with <C-v>. Does it do this when starting vim with vim -u NONE? – Tumbler41 Sep 8 '16 at 14:29
  • I agree with @Tumbler41: I can't reproduce this behavior. Have you mapped <space> to your leader? See the output of :imap <c-space> to find out if it is mapped to something. See also this question – statox Sep 8 '16 at 14:36
3

When you press <C-Space> in insert mode, Vim understands <C-@> which is a built-in command that inserts the previously inserted text and leaves insert mode.

You can't see <C-@> in :imap because it is not a mapping.

But you could have pieced all that together from the doc:

:help i_ctrl-a
:help ".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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