How to set up neocomplcache


I just started using vim and saw a cool plugin: neocomplcache.

My problem is that I can't get it to work properly. After installing, I took the example config from the help files of neocomplcache and added the lines to my .vimrc

At first I wanted to create a simple LaTeX file (there are snippets for TeX). After typing "begi" there appears a menu, I can choose between the snippets with Tab or CtrlN. But how do I get them to expand? CtrlK does not work, but I don't understand why.



" Plugin key-mappings.

imap <C-k>     <Plug>(neocomplcache_snippets_expand)

smap <C-k>     <Plug>(neocomplcache_snippets_expand)

inoremap <expr><C-g>     neocomplcache#undo_completion()

inoremap <expr><C-l>     neocomplcache#complete_common_string()

" Recommended key-mappings.

" <CR>: close popup and save indent.

inoremap <expr><CR>  neocomplcache#smart_close_popup() ."\<CR>"

" <TAB>: completion.

inoremap <expr><TAB>  pumvisible() ? "\<C-n>" : "\<TAB>"

" <C-h>, <BS>: close popup and delete backword char.

inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"

inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"

inoremap <expr><C-y>  neocomplcache#close_popup()

inoremap <expr><C-e>  neocomplcache#cancel_popup()


Best Answer

Typing <C-y> will insert the selected keyword and close the popup.
Typing <C-l> will insert the common substring between the matches in the popup.