lsp
lsp copied to clipboard
Enable tab for autocompletion
This is not so much a code issue as it is a question or perhaps a suggestion on a configuration to add.
Is there a way to enable the <TAB> keybind to cycle through the autocomplete suggestions and then insert the currently highlighted option once typing? Basically I want to be able to hit tab and have it move through the popover and then insert the highlighted option once I hit
Actually I figured out a good way to accomplish this:
inoremap <expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr> <S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
This snippet will allow your vimrc to use tab for auto-completion. Can we consider adding this as a feature-flag for the lsp configuration?
I think adding this to README is enough.
I added the 2 lines above added to my vimrc.
If I open a file configured to use an lsp, TAB
is not working as C-n
If I run :so ~/.vimrc
, TAB
starts acting as C-n
Any idea why?
Cheers!
@carlotm did you restart your vim after editing the vimrc? You either have to restart vim or source vim for changes to take place. If it is still happening even after restarting vim, I would check what your sourced vimrc path is. There is a variable $MYVIMRC that can be checked to see which vimrc was found and sourced.
Issue was UltiSnips, if I disable it, everything works ok. Thanks.
Hello guys, I'm trying to ask here because my question is about completion as well. Hope it's ok. I am new to Vim, so maybe it is a stupid question.
Is it intended behaviour that after <C-y>
when choosing the completion parenthesis aren't completed as well?
After I press <C-y>
for a first time, the list is reduced:
And pressing it again in this particular situation does basically nothing. I'm on Mac, if it matters.
Many thanks!