Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen people being able to use vi for programming purposes and being able to see e.g. the methods a file contains, jump from a method invocation to its definition etc. I.e. being able to use it a full featured programming editor.
How can I do this? Do I need some special plugins? Is there an easy guide for setting this up?

share|improve this question
You have probably seen VIM do this.... – mdpc May 14 '13 at 17:45
@mdpc:In my mind vi and vim are the same (perhaps erroneously).So how do they do this? – user65971 May 14 '13 at 17:48

If you want to use vim to programming here are some useful plugins (and other):

  • ctags or similar to generate list of your functions, variables,...
  • vim-taglist to show your functions, variables,...
  • vim-taboo to manage your tabs
  • vim-sqlutilities if you want to format your sql-queries
  • omni-completion
  • your preferred language-specific vim-plugins
  • etc, etc, etc.
share|improve this answer
I am sorry for the lamen question, but how do I install the plugin? – user65971 May 14 '13 at 18:16
Completely depends on the environment. Some distributions include various plugins in the package repository. If they own, then you'll have to download and for the install the plugins. Each plugin will probably include a README/INSTALL file with instructions. Read those. – Zoredache May 14 '13 at 18:51
@Zoredache:When you say plugin you mean an rpm right? – user65971 May 14 '13 at 19:14
No I didn't. I mean plugin as in VIM plugin. I also wouldn't have meant RPM, since I am very much a Debian/Ubuntu person, which uses .deb as the format for files in the package repository. Not that it matters, my comment was meant to be generic. Start by searching for packages built into to your distro. If they are not present, then you have to build and install them yourself. – Zoredache May 14 '13 at 19:18
If you haven't got package from these plugins, you'll download and (generally) should copy ~/.vim/plugins or ~/.vim/ftplugins. – uzsolt May 15 '13 at 6:55

You most likely don't have vi on your system. Most Linux distributions use Vim instead and link the vi command to Vim which is an improved version of vi that tries to stay compatible with it. In the future, try to write "Vim" (or "VIM" or however you want to capitalize it) when you don't specifically ask something about the old and dead vi that nobody uses anymore (Yes, I know someone will downvote this answer and comment that he uses vi…).

The default Vim is often a "tiny" version that lacks useful features like clipboard, multibyte or Ruby/Python support, for example. Use your distribution's package manager to make it more useful by installing vim-gtk or vim-gnome.

If you need a plugin or a colorscheme, the best place to look at is If you are working with a specific language, you can try to google vim $language ide: there are many tutorials.

  • "see the methods a file contains"

    You are probably thinking about TagList or TagBar. Both plugins use an external program called ctags (there are a bunch of language-specific alternatives) to generate an index of your code.

  • "jump from a method invocation to its definition"

    This is typically done by pressing <C-]> with the cursor on the method name and depends on a tags file generated by ctags against your code. See :help tags and :help ctags.

    If the definition is in the same file, you can use gd which has no dependency.

If you are genuinely curious about Vim, I'd suggest you try to learn to use it with as few plugins as possible: you can do a lot with bare Vim and no plugin as it comes with syntax highlighting, indentation rules, completion and specific settings for dozens of languages and many other useful features.

One very important thing to keep in mind, though, is that Vim is not an IDE. It doesn't have an internal parser that scans your code in real time to report syntax error or perform smart refactoring. Vim is a text editor geared toward programmers: it doesn't understand your code at all but it offers the kind of unparalleled text editing features that programmers like.

You can install many plugins and think you have an IDE but you don't. Keep that in mind.

Finally, here are the two lines you need to put in your ~/.vimrc:

filetype plugin indent on
syntax on

The 1st one activates language detection and language-specific settings, indenting and so on.

The 2nd one activates syntax highlighting.

Suggested reading:

:help quickref
:help usr_01 and following
:help windows
:help motion (my favorite)
share|improve this answer
+1. Very helpful.The 1st one activates language detection and language-specific settings. You mean programming language or locale? – user65971 May 14 '13 at 19:56
Programming language of course. – romainl May 14 '13 at 19:59
So the idea is that I run ctag over the code base and then I use vi on the source code – user65971 May 14 '13 at 20:03
No, you use Vim. And what you do over the code base depends on what outcome you want. If you want to be able to "jump to definition" and back you must generate a tags file and make sure it is somewhere Vim can find it (:h ctags) before you can use one of the commands/shortcuts listed in :h tags. – romainl May 14 '13 at 20:12
-1 I still use vi – Darth Android May 14 '13 at 21:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .