I'm a long time user of Sublime Text, and the default behavior for completions there is as follows:
down-arrow: highlight next completion
up-arrow: highlight previous completion, or regular up arrow behavior if at top of list
Tab/Enter (with completions window open): Choose the currently highlighted completion, close the completions window, and place the cursor after the completed text.
I'd love to be able to use Enter to choose the currently highlighted completion and close the completions window all in one. For passivity, this would likely have to be an option that defaults to off.
This is already possible; see the Options section in the README for details.
I found
ycm_key_invoke_completion
ycm_key_list_select_completion
ycm_key_list_previous_completion
but none of them close the completions dropdown menu. Did I miss a setting somewhere that closes the completions menu?
Why would you need a key to close the popup menu if it already close automatically when you continue typing?
Because I often complete a word (using tab), and then immediately need to use an arrow key (up or down)
I am aware I can go to normal mode and use j and k for up and down, but these are habits developed before I became a vim user.
Also the popup window is somewhat distracting, so it's nice to be able to close it if I need to think what I'm going to type next.
No Vim/Vi user should use arrows keys, this is blasphemy.
I used something like this with neocomplete
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return pumvisible() ? neocomplete#close_popup() : delimitMate#ExpandReturn()
endfunction
@Valloric I've been looking all through the issues & the README for this option. It doesn't seem to be given in this discussion either. Can you just point to the correct option to configure?
@calebmeyer wrote:
Because I often complete a word (using tab), and then immediately need to use an arrow key (up or >down)
I am aware I can go to normal mode and use j and k for up and down, but these are habits developed >before I became a vim user.Also the popup window is somewhat distracting, so it's nice to be able to close it if I need to think what I'm going to type next.
Hi @calebmeyer , I'm trying to solve the same problem. I wrote a comment here (for reference #232 )
Did you find a way to disable it?
Thank you.
@drbeco
(self-mention to help me find it easier in the search)
Hey @drbeco, I didn't. I still love vim for its ubiquity (it's hard for me to find a non-windows system that doesn't already have it), but I'm not using it as my daily driver anymore.
Atom has autocompletions which are built in and require no setup, and t9md/atom-vim-mode-plus meets my vim needs very well (except for macros, which I've given up for the other benefits of atom).
I hope you find a solution that works for you.
Hello @calebmeyer ,
As a matter of fact, I solved my problem exactly the way I wanted. I shared the solution I came up with in the other thread ( #232 ), but I guess I might share here as well, it fits better the topic.
let g:ycm_key_list_select_completion = ['<TAB>']
let g:ycm_key_list_previous_completion = ['<S-TAB>']
let g:ycm_key_list_stop_completion = ['<C-y>', '<UP>', '<DOWN>']
This will make arrows ignore the menu. You don't need to map <ENTER> because it is a good thing to keep it to just create a new line. Just hit <TAB> and 1. keep writing, 2. create a new line or 3. navigate with arrows. Very good, I liked very much the end result.
I hope this works for you. If not, the same variables above can be tweaked to change how <ENTER> works.
For more information, take a look at #232