tags:

views:

306

answers:

3

Hi, 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!

+1  A: 

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.

Greg Hewgill
Is there any way to auto-complete not only the variable names but also struct/class's member and methods?
Yang Bo
Ctrl-PCtrl-Nand an other one I have forgotten..(how did you get this render for C-p?)
Aif
+1  A: 

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.

Michael Madsen
Yeah, it is just what I need. But, I want to the auto completion can complete the C/C++ struct/class's member and methods, how can I achieve this?
Yang Bo
+3  A: 

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...
osgx