ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.43k stars 2.81k forks source link

remaps for insert mode are inflicted by this plugin #4237

Closed danielrehsmann closed 1 week ago

danielrehsmann commented 4 months ago

Issue Prelude

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

Normally I handle long lines with inoremap gk inoremap gj

however, the keymaps set by the plugin persists, and :imap

gives i * pumvisible( ) ? "\" : "\"

which checks if the dropdown menu is open. Is there a way to remap the arrow keys in a way that includes long-line handling?

bstaletic commented 3 months ago

inoremap gk, and

That does not look like a mapping that could do anything useful. Something might be off with your formating.

If you want to close the pum before doing something else in your mapping, see :h i_CTRL-y.

danielrehsmann commented 3 months ago

I edited the command accordingly. Basically i just want to navigate also in long lines that are wrapped graphically.

danielrehsmann commented 1 week ago

Basically, the Ycm configuration file was capturing the imaps: I had to comment out the following two lines of code in the ycm configuration file, /.local/share/nvim/plugged/YouCompleteMe/autoload/youcomplemete.vim

 for key in g:ycm_key_list_select_completion
   exe 'inoremap <expr>' . key .  ' pumvisible() ? "\<C-n>" : "\' . key .'"'
 endfor
for key in g:ycm_key_list_previous_completion
  exe 'inoremap <expr>' . key . ' pumvisible() ? "\<C-p>" : "\' . key .'"'
 endfor

you can check if ycm captures your keymaps with

verbose imap <up>

to locate the file.

Then I added the following two lines to my init.vim:

inoremap <expr> <up> pumvisible() ? '<c-p>' : '<c-\><c-o>gk'
inoremap <expr> <down> pumvisible() ? '<c-n>' : '<c-\><c-o>gj'