26

I've been looking for a while, but I can't seem to find any documentation on this key-command. Just by playing around, it seems that CTRL+Space inserts the text that was typed in the last insert-mode session.

However, is something more subtle going on? What exactly does this key-command do in vanilla Vim?

Casey Falk
  • 2,617
  • 1
  • 18
  • 29

1 Answers1

48

<C-Space> doesn't do anything in any mode by default. Try :verbose map <c-space> to see where it is mapped to do what you see.

edit

I somehow forgot about that previous answer to a related question:

When you press <C-Space>, the terminal sends an ambiguous signal to Vim which interprets it as <Nul>. Because <Nul> is usually represented as <C-@>, Vim acts as if you actually pressed <C-@> and tries to insert the previously inserted text.

Note that this issue is not present in GVim/MacVim.

Community
  • 1
  • 1
romainl
  • 186,200
  • 21
  • 280
  • 313
  • Oh! Interesting. I must have something in my `.vimrc` that I wasn't aware of. Thanks! – Casey Falk Jul 27 '14 at 17:45
  • @CaseyFalk You might want to also check `:verbose imap ` – FDinoff Jul 27 '14 at 18:06
  • 1
    Interestingly `map`, `nmap`, and `imap` each report, "No mapping found." o.0 – Casey Falk Jul 27 '14 at 18:07
  • Hmmm... this link also seems to argue that c-space *does* do something: http://shallowsky.com/blog/linux/editors/vim-ctrl-space.html . I checked my `.vimrc` and I have no additional mappings. I'll keep exploring... – Casey Falk Jul 27 '14 at 18:25
  • 1
    @CaseyFalk, see [this answer](http://stackoverflow.com/a/7725796/546861) to a previous question. – romainl Jul 27 '14 at 18:38
  • Ahh! And lo-and-behold: "Insert previously inserted text and stop insert." – Casey Falk Jul 27 '14 at 18:40
  • So, by default the key combo actually is understood by Vim as -- which inserts previously inserted text (as I was experiencing). Awesome! Thanks @romainl. So *does* do something. – Casey Falk Jul 27 '14 at 18:41
  • 3
    No, `` does something. `` is badly interpreted by the terminal which sends bogus info to Vim which does what it can with what it gets. Vim doesn't receive `` at all so `` does nothing and is not used for any command in Vim by default. – romainl Jul 27 '14 at 18:48