VIM) Overriding arrow keys on popup menu of 'You complete me' only works on 'down'

Viewed 400

Env: VIM 8.2.2815, PluginManager-Vundle

I installed YouCompleteMe Plugin for VIM. I use arrow keys a lot for moving between lines and characters. But YouCompleteMe popup hijack my arrow command so I decided to change key mapping.

First, I found that there is a default mapping for completion select like below. I added these lines to ~/.vimrc

let g:ycm_key_list_select_completion = ['<TAB>', '<Up>']
let g:ycm_key_list_select_previous_completion = ['<S-TAB>', '<Down>']

So I removed <Up>, <Down>. But it doesn't work. According to this link : https://github.com/ycm-core/YouCompleteMe/issues/2336, it might be a problem of VIM. So I added lines below to ~/.vimrc

inoremap <expr> <up> pumvisible() ? '<c-y><up>' : '<up>'
inoremap <expr> <down> pumvisible() ? '<c-y><down>' : '<down>'

It worked. But only works on 'down' arrow, not on 'up'.
I have searched github YCM issues and google, but couldn't find any solution.

Is there any way to get it fixed?

edit) I found out that arrow key has weird behavior. When set showcmd is on, hitting both <Up> and <Down> shows ~@k on the right below of my vim. It can be a problem of mobaXterm or ssh, but not sure...

0 Answers
Related