-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support selecting the first completion option / Remove 'noselect' from completeopts #3573
Conversation
I'm a bit of a vimscript novice but this snippet doesn't seem to work, since |
I think I can reproduce what you're seeing when I don't use function! RemapAleCompletion()
" Load autoload/ale/completion.vim and the <Plug>(ale_show_completion_menu) mapping
ALEComplete
" or:
" call ale#completion#GetCompletions('ale-manual')
iunmap <Plug>(ale_show_completion_menu)
inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o>
endfunction
augroup remap_ale_completion
autocmd!
autocmd VimEnter * call RemapAleCompletion()
augroup END |
49b3f16
to
9fffebf
Compare
Now I can accept the first completion with `<Tab>` or `<Right>` instead of `<Down><Tab>` or `<Down><Right>`. Requires my patch to ALE: dense-analysis/ale#3573
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of this change, we need a separate Plug
mapping for manual completion (ale-manual
) so we don't send C-p
to back out of selecting the first item. This can be done by adding an argument to s:OpenCompletionMenu
to change which Plug
key it sends. We can't select the first item from automatic completion as it will interrupt typing, but we can when you open the completion menu through a keybind.
I actually use this with automatic completion. The |
9fffebf
to
1977215
Compare
This patch removes `noselect` from the default `completeopts`. This should no longer be necessary thanks to 25b572b, because the `<C-p>` added to the map will deselect the first entry. Combined with something like this in your `~/.vimrc`: ``` function! RemapAleCompletion() iunmap <Plug>(ale_show_completion_menu) inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o> endfunction augroup remap_ale_completion autocmd! autocmd VimEnter * call RemapAleCompletion() augroup END ``` This can address dense-analysis#3433.
1977215
to
674ff78
Compare
I'm gonna replace this with an alternate patch which respects the value of |
This patch removes
noselect
from the defaultcompleteopts
. This should no longer be necessary thanks to 25b572b, because the<C-p>
added to the map will deselect the first entry.Combined with something like this in your
~/.vimrc
:This can address #3433.