roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Disable arrow keys in insert mode to run through selection in favor of <TAB> and <s-TAB> #188

Closed sdrap closed 6 years ago

sdrap commented 6 years ago

Since I use nvim for latex use, I move around text in insert mode. However, as soon as I pass through a keyword, the pop up triggers and I run through the options instead of moving up or downwards in the text.

I could remap the tab key for moving through the choices but could not figure out how to disable the arrow keys for the completion (however I want to keep for the sequential completion of markers in neosnippet)

Here is what I have so far (key mapping was always kind of esoteric for me in vim)

inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
imap <c-j>     <Plug>(neosnippet_expand_or_jump)
vmap <c-j>     <Plug>(neosnippet_expand_or_jump)
inoremap <silent> <c-u> <c-r>=cm#sources#neosnippet#trigger_or_popup("\<Plug>(neosnippet_expand_or_jump)")<cr>
vmap <c-u>     <Plug>(neosnippet_expand_target)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

Help would be very appreciated, since the completion works otherwise like a charm :).

SuperPrower commented 6 years ago

Agreed! Would be cool if somebody shared their configuration to disable arrow keys.

roxma commented 6 years ago

imap <expr> <down> pumvisible() ? "\<c-e>\<down>" : "\<down>"