Mark Needham

Thoughts on Software Development

Vim: Learnings so far

with 8 comments

I’ve been using Vim instead of RubyMine for the last month or so and it’s been interesting observing the way that I browse code as I add plugins to make my life easier.

Between files

I generally don’t know exactly where in the folder structure different files live since I’m used to being able to search by just the name i.e. RubyMine’s Ctrl-N

Yahuda Katz wrote a blog post earlier in the year where he listed some of the plugins he’s been using – one of which is called Command-T and allows exactly this functionality.

I also quite like the ability to quickly access files that I’ve recently opened i.e. files which are in the Vim buffer or RubyMine’s Ctrl-E. The FuzzyFinder plugin provides that functionality.

I’ve also tagged all my Ruby gems and the source code of the project using Exuberant CTags which then allows easy browsing to methods/classes.

Inside files

I’ve noticed that the way I browse inside files has changed since I started using Vim.

I used to just scroll around files using the mouse but now I find myself moving around a file by line numbers instead.

A lot of the commands for file editing in Vim are based on moving/changing/deleting to a particular symbol so you become almost a human parser when reading a line of text.

I found/am finding the following quite useful for learning Vim shortcuts:

When coding in Java/C# I rely quite heavily on auto complete to tell me what methods I have available to me on a certain object.

Although I don’t use it that frequently the SuperTab plugin works reasonably well when you do need help.

Mike pointed out Vimlander-2-The-Quickening which has some of the plugins I mentioned and several others ready to use.

Written by Mark Needham

December 27th, 2010 at 7:15 pm

  • Pingback: Tweets that mention Vim: Learnings so far -- Topsy.com

  • Rickard Lindberg

    Interesting to see how you use Vim.

    You can also supply the –extra=+f to ctags to include file names in the tags file. That way you can jump to files like any other tag (of course ctags has to know about that file type).

    I use the :tj command quite frequently to jump to files. (You can also add wildcards to complete long file names: :tj th*is*secret*html will find thisIsAVerySecretFile.html.)

  • Kovica

    Very interesting. I’m VERY interested in hearing how did
    you make code complete work for Java?

  • http://hamletdarcy.blogspot.com Hamlet D’Arcy

    Ted Nelaid also made a nice Vim wallpaper:
    http://naleid.com/blog/2010/10/04/vim-movement-shortcuts-wallpaper/
    Is Vim actually better than RubyMine in any way? I am assuming it
    is cheaper and faster, but does it have any functionality that
    RubyMine does not have?

  • http://www.leonardoborges.com Leonardo Borges

    What about refactoring support?

    RubyMine has been doing a pretty decent job on that land.

  • http://hamletdarcy.blogspot.com Hamlet D’Arcy

    Ted Nelaid also made a nice Vim wallpaper. I can’t link to
    it because the comment filter blocks me. Search google for “Ted vim
    wallpaper” Is Vim actually better than RubyMine in any way? I am
    assuming it is cheaper and faster, but does it have any
    functionality that RubyMine does not have?

  • http://www.chrisbushell.com Chris Bushell

    I’ve also found the O’Reilly vi Editor Pocket Reference by
    Arnold Robbins to be helpful, along with the iphone app Vimmy,
    which is a really basic, but very useful reference to have on
    hand.

  • Mark Needham

    @Leonardo Ive been doing all refactoring manually but I was finding with RubyMine that it was often changing things which I didn’t want it to change when I used the refactoring support so I don’t miss it that much.

    Also allowed me to get into using a bit of sed/awk to search for the places that I wanted to change.

    @Hamlet thanks for the link to the wallpaper – a colleague had a similar one for emacs bit I didn’t know there was a vim one, neat.

    I find actual text editing faster in vim now that I’ve used it a little bit. I guess an lyre stove approach would be to use vim key bindings in RubyMine but where’s the fun in that!