Last Updated: February 25, 2016
·
4.831K
· bendoerr

Vim Ctrl-Space Omni & Keyword Completion

Ctrl-X Ctrl-O and even Ctrl-P are pretty awkward for me, so I use the following mapping:

" Ctrl-Space for completions. Heck Yeah!
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>

This makes my fingers much happier.

2 Responses
Add your response

SuperTab might be relevant to your interests http://www.vim.org/scripts/script.php?script_id=1643

over 1 year ago ·

Awesome, I'll take a look at it. Although <tab> for completion might be a bit for me to get used to. I come from a heavy IDE background so <C-Space> is where my muscle memory is at.

over 1 year ago ·