I’ve recently made the upgrade from the wonderful Mac text editor Textmate to Vim (in the form of MacVim). What initially led me away was a hope to be able to run SPSS syntax from within Vim, which would allow me to avoid SPSS 16′s abysmal syntax editor. While this turned out not to work quite as easily as I had hoped, and is still a bit broken (a post for another time), I learned quite a bit about Vim’s scripting language. Seeing how easily extensible Vim was, I decided to make the switch full time. I downloaded a copy of MacVim and started creating my .vimrc.
The first thing I did was create an easy way to update my Git repositories when I was finished editing them. This turned out to be ridiculously simple. Just put this in your .vimrc:
creates a new command in Command mode called “Commit”. So if you hit “:” to switch to Command Mode in vim, and type:
and hit return, it will commit the changes to the repository and then push the code for you. This makes it effortless to keep your repositories up to date from within Vim.
I’m still retraining myself to navigate around the document using the shortcut keys. The shortcut keys, when I am in the mood where I actually use them instead of arrowing around, sped up my code development greatly. Also, being able to run terminal commands from within Vim has provided me with countless new ways of interacting with my code. I’d highly recommend everyone spend a month or so using Vim. The learning curve is a bit harsh at first, but the payoff is fantastic.
More Vim tips to come, along with some zsh tips and the SPSS/Vim bridge.