Skip to content

How to turn VIM into an IDE

I am by no means a full-time software developer, but I find myself from time-to-time needing to dig into some code. While many developers use an IDE, I find IDEs overkill for my use-cases and an unnecessary dependency on my systems. I recently saw a colleague using VIM very similar to an IDE and I become intrigued. With a little help, I got everything setup and now have an easily portable IDE in an interface I frequently use: VIM. In this post, I would like to walk through the steps that were shown to me to get this all setup.
Vimlogo.svg

Dependencies

  1. VIM
  2. vim-pathogen — VIM plugin manager
  3. Tagbar — VIM plugin that gives you a nice class explorer
  4. NERDTree — VIM plugin that gives you really good file system navigation
  5. ctags — allows you to use some VIM features to navigate source code like an IDE (can use macports to install)
  6. cscope — allows you to use some VIM features to navigate source code like an IDE (can use macports to install)

Next Steps

Once you have everything installed and configured, the next step is to feed data into ctags and cscope. To do this, you need a script that can search for you source code. For Java, you could use something like the following:

You should call this script when you enter your source code directory and whenever major additions/deletions of source code files occur. With this in place, you are good to go! Now you can either execute vim with the Java class you are interested in by doing:

or from within VIM by doing:

Then, depending on how you configured your .vimrc file you can use the appropriate map for the TagbarToggle and/or the NERDTreeToggle. In my case, I opted for the following mapping:

The only other advanced thing to leverage is VIM splits:

  • ctrl-w v for a vertical split
  • ctrl-w s for a horizontal
  • ctrl-w plus a movement key (h/j/k/l) to move around them

I am not sure about you, but I find this setup awesome. Happy coding!

© 2015, Steve Flanders. All rights reserved.

Published inSystem Administration

2 Comments

  1. David Gillooly David Gillooly

    Many students in Java write very short java programs that use args. Can this be made to work in that type of situation too?

    • Hey David — thanks for the comment! Can you elaborate on what you mean?

Leave a Reply

Your email address will not be published. Required fields are marked *