Vi (Vim) and Eclipse

It’s been a while since I posted last, and a lot of stuff has happened. The most important thing that’s happened, though, is that I’m back at collage, and starting on a computer science degree.

The school I’m going to teaches Java as it’s introductory programming language, and uses Eclipse as the IDE for the class. I don’t have anything negative to say about Eclipse. It’s a great open source IDE if you don’t mind long load times and code completion pop-up windows. However, the teacher I have expresses frustration about said pop-ups all the time. I wonder if listening to him complain is as annoying to me as the various quirks of Eclipse are to him? Last class I decided to ask him what he preferred to code Java in. It turns out that he does pretty much all his programming in Vi (or Vim).

Assuming my instructor was a bit of a masochist, but also realizing that there was going to be future classes at my school that required the use of Vim, I decided to give coding in that command line editor a try. I spent an entire night working on the third CS project for the class in Vim, and only used Eclipse if I got stuck. As it turned out, I didn’t need to use Eclipse much at all. It took some time to get used to the lack of automatic code completion (which lead to a lot of errors early on), but after a short time, I stopped copying little bits of code over to Eclipse for debugging, because everything seemed to work fine in Vim. I must say that, for a command line utility, Vim is really useful.

But, I was still right about my teacher being a bit of a masochist. The project had us writing five separate class files, two or three of which we would need to edit simultaneously to get the program to run properly. That’s not something I enjoyed dealing with in Vim. It wasn’t too hard, but I really missed my GUI file tabs. Even gedit has GUI file tabs for multiple documents. Vim might be a better editor for programming languages that are less likely to require you to edit multiple files simultaneously, but Java doesn’t seem like a good fit.

My basic conclusion is that, if all you have is the command line, Vim is great (don’t talk to me about emacs; I haven’t coded anything interesting in emacs yet), but if you’re coding in Java and have a desktop GUI of any kind running, there are probably better options available, and if you like IDEs with lots of bells and whistles, Eclipse seems great.


7 thoughts on “Vi (Vim) and Eclipse

  1. While vi is a pain to start off with, I really miss it when it’s not around. I ended up getting a vi plugin for eclipse (The required IDE for the company I work at) which lets me keep the keyboard interface I like and still have all the debuging power of eclipse.

    If interested the one I use is at There are also a few open source ones, but I haven’t tried them out.

    Oh, and if you are a true masochist there is a vi plugin for Microsoft Office (unfortunately its about $100).

  2. I do all my programming in Vim. C++, Perl, Python, because Vim has automatic indenting, autocompletition, omni completition, tabs, split views, showing errors.. And most important thing: Everything can be done with the keyboard. It is nicer to work with keyboard on laptop, then with touch pad.

  3. If you really like tabs (which I do), and you want to use them in vim, go into command mode and type :tabnew FILENAME and it will open the file FILENAME in a new tab. This works whether you are using vim via command line or if you are using gvim. The catch is that only gvim has tabs that you can click on to switch between. If you want to switch tabs without using the mouse, in command mode type Ngt where N is the number of the tab you want to jump to (starting with 1 on the far left). If you just want to skip to the next tab, then just type gt.

    I think you have to set vim to non-compatible (as in non-compatible with vi) mode before this will work though. Also, I like to bind Ctrl-T to make a new tab (like in firefox), so if you add this to your .vimrc, you can do the same:

    set nocompatible
    map :tabnew

    This will make it so that when you type Ctrl-T, it will go to command mode and type the :tabnew for you so that all you have to do is type the filename.

    Hope this helps!


    By the way, the other way to edit multiple files at once is using something called “split windows”, you might want to check it out.

  4. Alternatively, you can use the MiniBufExplorer Vim plugin. Gives you tab functionality for navigating your opened files/buffers. 😉

  5. If you want to make vim more Eclipse/Gedit-like, then try running the graphical version: gvim.

    You will be able to drag and drop files, have a file menu (try File > Open Tab), use toolbar buttons, click on tabs to switch focus, and generally use the mouse to move around.

    As for code completion, try Ctrl+N. Also, you can look into ctags and omnicompletion.

  6. In VIm there are split windows, much like tabs, and even if it’s not GUI, but you can set the mouse option on, and the split windows will be responsive to mouse clicks.
    There is also autocomplete plugins for pretty much every programming langauge, and syntax highlighting.
    Vim is great, I’ve never used eclispe though.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s