Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 608
Yang Bo Avatar asked Jan 18 '10 02:01

Yang Bo


People also ask

Does Vim support auto-completion?

Vim text editor supports autocompletion for the standard text files by default. Also, when configured properly, Vim enables an autocomplete feature for files with code in the languages it recognizes. In this tutorial, we'll see how the autocompletion support in Vim works.

What is auto code completion?

Autocomplete of source code is also known as code completion. In a source code editor, autocomplete is greatly simplified by the regular structure of the programming language. There are usually only a limited number of words meaningful in the current context or namespace, such as names of variables and functions.

Can you get Intellisense in Vim?

Intellisense. The auto-completion system (Intellisense) in VSCode is arguably its best feature. Lucky for us, it's been ported over to Vim!


2 Answers

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.

like image 166
Greg Hewgill Avatar answered Oct 22 '22 09:10

Greg Hewgill


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.

like image 21
Michael Madsen Avatar answered Oct 22 '22 09:10

Michael Madsen