Take the 2-minute tour ×

After searching a bit on the net it seems that I can't map ctrl space to anything/alot. Is there a way to do it today, what I found was usually 2 years old.

share|improve this question
add comment

3 Answers

up vote 18 down vote accepted

I've run into the same issue, the short answer is yes you can, and not only in the gui version. Adding this on you .vimrc is enough:

inoremap <C-@> <C-Space>
share|improve this answer
That is sort of ingenious :) Thank you. –  plitter Sep 12 '12 at 22:27
Hahaha thanks, I broke my head with that one D: –  PaBLoX Sep 13 '12 at 3:15
I know this is really nitpicking, but I would consider using inoremap instead of just imap, since the former will make sure that any messing around you do later won't change these settings. But, really, that's overcautious overkill. –  Riley Jun 10 '13 at 16:09
That's true, it's good practice. I'm fixing my answer. –  PaBLoX Jun 22 '13 at 22:34
For me it's working just inoremap <C-@> <c-x><c-o> (on linux) –  pevik Sep 26 '13 at 6:46
show 1 more comment

The problem seems to be that Terminal.app doesn't interpret <C-Space> correctly and Vim understands it as <C-@> which is a built-in mapping (:help CTRL-@).

Maybe you could go with something like the following in your .vimrc:

if !has("gui_running")
    inoremap <C-@> <C-x><C-o>

which seems to work, here, but I don't like the idea of overriding built-ins like that.

Instead you should try with <Leader> (:help leader), it gives you huge possibilities for defining your own custom mappings and (depending on the mapleader you choose) won't interfere with OS/app specific shortcuts/limitations and hence be more portable.

With this in my .vimrc:

let mapleader=","
inoremap <leader>, <C-x><C-o>

I just hit ,, to complete method names.

share|improve this answer
It is not only Terminal.app who outputs NULL when you type <C-Space>. I won't be surprised if I find out that it is written in some standart: at least urxvt and konsole also do this thing. –  ZyX Oct 11 '11 at 19:28
add comment
  • Have you tried :inoremap <c-space> <c-x><c-o> ?
  • Does Ctrl-X Ctrl-O do anything when you type in insert mode? Is omnifunc set?
share|improve this answer
add comment

Your Answer


