Vim (a text editor with roots in the 1970s) has been seeing a bit of a comeback recently, especially amongst the Mac using web development community. It seems as though slow progress on TextMate 2 has caused many of us to go in search of a new editor. Many Linux and BSD users never left it, and are probably wondering what all the fuss is about.
Vim is a clone of vi, which was written by Bill Joy while he was an undergraduate student at Berkeley. Bill later went on to found Sun Microsystems (clearly not somebody you want to underestimate). Vim is short for "Vi, IMproved", and has been in development since 1991.
I store my Vim configuration in a dotvim repository on GitHub. Feel free to have a poke about.
Articles on Vim
Navigating your bundled gems in Vim
Do you sometimes find yourself wanting to read the code of a method in one of the gems that your project is using? Wouldn't it be good if you could put your cursor on the method or class in question, and press a key to jump straight to the definition within the gem's source code? With the
ctagsprogram you can, and with the
guard-ctags-bundlergem your tag files will be automatically updated when you add new gems to your bundle.
Running MacVim in your terminal
A recent version of Vim comes with every copy of Mac OS X. When Apple compiled it they didn't link it against Ruby, which means that you can't use
/usr/bin/viwith any Ruby based plugins. MacVim (which includes Ruby support) normally runs with a GUI, but you can run it in a terminal when you type
viif you prefer.
Patching "bundle open" to set your current directory
Ruby programmers need to be able to read the source code of the libraries (gems) that they use. Bundler makes it easy to load the source of a gem into your editor, with the
bundle opencommand, but it'd be useful if it changed your current directory before launching Vim.
Host specific Vim config
I manage my Vim config in Git and store the files in a dotvim repository on GitHub. It allows me to share the config easily between multiple computers. Sometimes, I want Vim config that is specific to just one of my computers.
Changing Vim's window size
Picking up the corner of the window with the mouse and painstakingly dragging it to the correct size is annoying, especially when you're trying to hit the right width to show 80 columns of text. This article will show you how to configure Vim to jump between various configurations when you wield the appropriate key bindings.