I Want to use Ctrl+Space for omni-completion (and keyword completion if there is no omni-completion) in vim. I've tried this which I found somewhere on the web:
inoremap <expr> <c-space> pumvisible() ? "\<C-n>" : "\<C-x>\<C-o>\<C-n>\<C-p>\<C-r>=pumvisible() ? \"\\<Down>\" : \"\\<CR>\""
however it's not working. Anyone who is using Ctrl+Space for this too who can show me the correct way (which works) to do it?
Worth noting is that it needs to work in the terminal version of vim NOT gvim.
Thanks in advance!
From stackoverflow
Marlun
-
Try this:
inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ? \ "\<lt>C-n>" : \ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" . \ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" . \ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>" imap <C-@> <C-Space>From sykora -
I've tried the same solution before (found it at http://blog.sontek.net/2008/06/12/vim-tip-use-ctrl-space-for-omni-and-keyword-completion/) however it never worked. Now it did.
From Marlun
0 comments:
Post a Comment