Vim: auto complete

I use ctags, taglist, etc. to auto complete in vim. However, it is very limited compared to Visual Studio intellisense or Eclipse autocompletion. I am wondering if Vim can be configured to:

  • Show autocomplete every time. or →. But only after some text, which may be a variable (for example, do not show automatic completion after the number).

  • Show functional parameters when (typed.

  • Stop deleting the autocomplete list when some of them delete all characters after. or →: When I enter the variable name, press. or → to search for a specific member, I often have to delete all the characters that I print after. or →, but this causes Vim to hide the completion list. I would like to keep it visible if I don't press Esc.

  • Display related automatic completion: when I enter a variable and press ^ X ^ O, it usually shows me all the tags in the ctags file. I would like it to show only tags associated with the variable.

Thanks for the help.

EDIT . Some people vote for this question, but no authority knows the answer. Therefore, I just wanted to mention that you do not need to give a complete answer; partial responses to any of the points mentioned would be good too.

+67
vim autocomplete
Jan 03 2018-11-11T00:
source share
7 answers

AutoComplPop is what you need.

+20
Jan 03 '11 at 15:50
source share
— -

For (1) when working with C ++ or C, clang complete is a really good option

+15
Jan 03 '11 at 15:30
source share

To force vim to trigger a specific keypress behavior, you need to map the key to a function.

For example, to match a key . to call some type of completion in INSERT mode you will need:

 :inoremap <expr> <buffer> . MyFunction() 

and then the function will need to evaluate the context in which it was called and provide the appropriate response to the user.

Change This is the foundation of how clang complete described by @honk.

I'm not sure that you can customize omnifunc behavior to suit your needs, but in my experience I have never gone too far. As @Mikhail said, you will need to keep track of everything that in practice means interpreting or even running the code to some extent.

+8
Jan 03 2018-11-11T00:
source share

I use vim every day and I don't know about an existing script that can do this. This action will require understanding the classes and tracking variables. someObject-> means that VIM will know which class is someObject variable, and then will be able to search for methods / variables in this class.

Writing scripts for vim is relatively simple, although as you commented, no one answered that. Vote from me.

+4
Jan 03 2018-11-11T00:
source share

I would like to have the same functionality that you are looking for and just stumbled upon a promising plugin:

https://github.com/Shougo/neocomplcache it looks like this could be a new autocomplpop, and seems to work very well during my initial tests ... now to configure omni, shutting down scala ~

+2
Jul 04 '12 at 18:36
source share

I recently discovered YouCompleteMe , which behaves similarly to the Visual Studio AutoFill tool. The demo can be seen here:

https://www.youtube.com/watch?v=YuMyHAHF0xs

+1
Jan 10 '15 at 10:46
source share

In any case, I recommend YouCompleteMe (YCM) . It provides (fuzzy) matching of the identifiers of your current file, as well as path completion, integration with external completion mechanisms, ...

ad 1)
If you like semantic eclipse termination, use eclim to integrate vim with eclipse. (alternatively use a different semantic engine for YCM)

ad 2)
: 2 YCM can even provide a function definition (= parameter list) of a recently completed function!

ad 3)
what ycm does anyway

ad 4)
not quite sure what you mean by that. never used ctags!

PS: I highly recommend using UltiSnips and Tagbar (and if you like UndoTree ), which makes vim the perfect IDE for me.

+1
May 7 '15 at 11:01
source share



All Articles