Arrow keys inserting ABCD after accepting completion in Maven project
Result from CocInfo
versions
vim version: VIM - Vi IMproved 8.2 8020550 node version: v13.13.0 coc.nvim version: 0.0.78-d5471449bf coc.nivm directory: /Users/sflomenb/.vim/plugged/coc.nvim term: iTerm.app platform: darwin
Output channel: java
[Info - 5:57:43 PM] JDT Language Server started [object Object]
Describe the bug
This is open happening in Java (using coc-java) when I am in a Maven project. When I accept certain completions, press escape to go back to normal mode, and then press an arrow key, I am put back into insert mode and one of the arrow key codes (A, B, C or D) gets inserted.
Reproduce the bug
We will close your issue when you don't provide minimal vimrc and we can't reproduce it
-
Create file
mini.vimwith:set nocompatible set runtimepath^=/path/to/coc.nvim filetype plugin indent on syntax on set hidden " load coc.nvim - this will depend on how you use your plugin manager call plug#begin('~/.vim/plugged') Plug 'neoclide/coc.nvim', {'branch': 'release'} call plug#end() " add some mappings used from README inoremap <silent><expr> <TAB> \ pumvisible() ? "\<C-n>" : \ <SID>check_back_space() ? "\<TAB>" : \ coc#refresh() inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use <c-space> to trigger completion. inoremap <silent><expr> <c-space> coc#refresh() imap <C-@> <C-Space> " use enter to confirm completion inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" " close preview window when completion is done augroup coc autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif " Highlight symbol under cursor on CursorHold autocmd CursorHold * :silent call CocActionAsync('highlight') augroup END -
Install Java and Maven
-
Generate a Maven project using the following command:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false -
cd my-app -
Start (neo)vim with command:
vim -u /path/to/mini.vim src/main/java/com/mycompany/app/App.java -
Inside of the main method, type
"hello".cont -
Use tab and enter to complete the
contains()method. -
Press escape to finish typing and go back to normal mode.
-
Press an arrow key to move the cursor. Instead, you will be put back into insert mode and a letter (A, B, C, D) will be entered depending on the arrow key you press.
Screenshots (optional)
I have uploaded a video at the following link.
Please let me know how I can help in any way.
This is occurring on both Macs I use. The one in the video was on macOS Catalina in iTerm 2, but it also happens on a Mac on macOS Mojave in Apple Terminal. Both using vim 8.2.
No idea.
Should be fixed on latest coc.nvim, avoid arrow keys is recommended.