Yang Bo
Yang Bo

Reputation: 669

Auto code completion in VIM?

Can VIM do auto code completion like what Eclipse does? Usually I connect to my Linux developing server through Putty from my Windows laptop. So, I hope I can find a plugin for VIM which can do drop-down menu like auto completion when I can type variable names in Putty, is this possible?

Thanks!

Upvotes: 12

Views: 10561

Answers (4)

Cloverr
Cloverr

Reputation: 238

Currently vim has no of plugins for the auto code completion feature, I am using youcompleteme plugin, combined with vim-snippets, ultisnips and supertab plugins. You can tab complete the code using snippets (a small text which can be expanded for full code), and a large number of languages are supported.

For simple text files also a drop down menu comes for the words you have typed earlier.

Upvotes: 1

osgx
osgx

Reputation: 94455

Try to use http://eclim.org/ - using eclipse core with VIM via plugins.

To not start the complete ecplise core but have a C/C++ member completion, try http://www.vim.org/scripts/script.php?script_id=1520

-   Complete namespaces, classes, structs and union members. 
-   Complete inherited members for classes and structs
(single and multiple inheritance). 
-   Complete attribute members eg: myObject->_child->_child etc...

Upvotes: 2

Michael Madsen
Michael Madsen

Reputation: 55009

Yes, it's possible. Vim already features that general style of code completion built-in, under the name of Omni completion.

The default installation doesn't allow for auto-invocation, but if you install this script, that allows it to happen.

Note that, depending on the language you'll be working with, you may need additional scripts to handle auto-completion for that language, and may even need to change the auto-invoke script to recognize when to invoke the completion. Since you haven't said what programming language you'll want to work with, it's a bit hard to say if you need more than this, but I recommend checking the help file.

Upvotes: 3

Greg Hewgill
Greg Hewgill

Reputation: 994531

Yes, in a sense - Vim has Completion commands that can help you automatically find the completion text for partial variable names.

In a nutshell, type a partial variable name and then press CtrlP to search for a matching name.

Upvotes: 16

Related Questions