After searching a bit on the net it seems that I can't map CtrlSpace to anything/alot. Is there a way to do it today, what I found was usually 2 years old.
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.
For example, add the following to . Xresources for xterm to send <Esc>[65;5u for Ctrl Shift A . You can then map that in Vim to <C-S-a> . (65 is the decimal Unicode value for shift-a and 5 is the bit for the ctrl modifier.
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-Space> <C-x><C-o>
inoremap <C-@> <C-Space>
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>
endif
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With