I know that I can get word completion through CTRL+N
& CTRL+P
and code completion through omnifunc with CTRL+X
CTRL+O
. I additionally tried Supertab (very nice), because I'm used to TAB-completion. That all worked all right. I would like to see possible matches while I'm typing, so I also tried autocomplpop.vim, witch does just that.
What I like to accomplish though, would be a combination of both together with a little twist: I would like to see suggestions pop up as I type (just like with autocompop
) but when I use TAB
the word should be expanded only to the largest common match:
foo bar testor booze test baz teter
te<TAB>
After I type te
in the 2nd line, the popup should suggest test
, teter
and testor
.
When I press TAB
, it should do nothing, because there is no more common ground than te
. After I typed an additional s
and press TAB
, it should expand tes
to test
(because it is the smallest common ground) and to testor
after a 2nd TAB
.
Edit: I try to be more clear...
te<TAB>
tes<TAB>
test
(because that works for both - test and testor - and teter is no longer a possible match). test<TAB>
testor
(only possible match).Well, the suggestions popup is just bonus, but I really would love to see the TAB
behavior. Hope I don't get to esoteric here and you can help me out with some script-tricks or plugins to tame VIM to do just that.
Vim editor supports Autocomplete by default for the standard text files and enables autocomplete for programmatic files by explicit configuration.
The auto-completion system (Intellisense) in VSCode is arguably its best feature. Lucky for us, it's been ported over to Vim!
Press Ctrl+Alt+S to open the IDE settings and select Editor | General | Code Completion. Under Machine Learning-Assisted Completion, enable the Sort completion suggestions based on machine learning option, and select the languages for which you want to use ML completion.
:set completeopt=longest,menu,preview
maybe?
(I'm not sure if your statement
"when I press TAB, it should do nothing, because there is no more common ground than te"
conflicts with your later statement
"to testor after a 2nd TAB."
It seems to me that there's no more common ground than "test" at that point... Unless you mean the first tab goes to the longest common ground, and then the subsequent tabs cycle through the other matches, in which case you're after what I have above...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With