60 Days of Vim
Sat, Apr 9, 2011In an earlier series of posts I talked about my first experiences switching to Vim:
- switching to vim
- getting started with vim
- navigating vim
- split windows and tabs in vim
- my favorite vim plugins
- my .vimrc file
I planned to give myself 30 days and see if vim becomes my editor of choice, but 30 days came and went and, although I was struggling, I continued to stick with vim but could not find the time to write up why I was still struggling with it.
Well here we are, now 60 days after switching over, and I am surprised to find myself still using it, and struggling less and less. So I thought I would make the time to write up my ‘Final Thoughts’ describing the positives and negatives of the switch and see if I can decide if it has become my editor of choice…
Positives
-
Cut the Mouse - One of the main wins for Vim has always been that it is an editor that lets you keep your hands on the keyboard. Reaching for the mouse slows you down, and while I never really had a problem with that in the past (I spend more time thinking and reading than I do writing code), now that I’ve experienced 2 months with my hands on the keyboard I do find myself noticing (annoyingly) when I am forced to reach for the mouse.
-
Fast Navigation - Moving around inside files in most windows editors involves a lot of home/end/up/down arrow key. Having search and tag based navigation makes getting around within a file much faster. Finding the right file is also easier with the commandt plugin, influenced by Textmate on the Mac, this fuzzy file finder is not typically available in traditional windows editors (last time I looked)
-
Split Windows - Splitting windows into panes and navigating around them is a killer feature that I use all the time to see multiple files at once, or multiple areas of the same file at once. In the past I used tabs heavily, but I now prefer split panes that I can manage without reaching for the mouse.
-
Awesome Plugins - I haven’t explored much beyond the plugins I talked about in the earlier article, but I now can’t imagine working without commandt, bufexplorer, ack, nerdtree, zoomwin
Negatives
-
HJKL - Sorry, call me a heretic but I just cannot get used to using these keys for up/down/left/right. 20+ years of using the arrow keys is completely and utterly embedded in my brain. Besides, I’m pretty sure J (down) and K (up) are bass-ackwards. Western languages, and presumably most programming languages, read from TOP LEFT to BOTTOM RIGHT so shouldn’t UP be next to LEFT and DOWN be next to RIGHT ??? I know I could remap the keys, but plugins that follow similar patterns would also have to be remapped and I just could not get used to it.
-
Mode Struggles - The modal nature of Vim is both a blessing and a curse. Its the feature that allows us to keep our hands on the keyboards without the wrist breaking key combo’s of Emacs but its also far too easy to forget which mode you are in and start typing code only to discover you just executed 5 random commands. The people who recommend you ESC constantly back into command mode are absolutely correct. You have to shift your thinking into being primarily command based with short sharp bursts of INSERT.
-
Breaking Windows - One of the side effects of the modal nature of vim is that it trains you to constantly hit ESCAPE to go back to command mode…. but when you do this in more traditional windows apps its quite possible you will end up dismissing a dialog while you are in the middle of typing! How frustrating! I hit this mostly when using Tortoise SVN for my code commits.
-
Disappointing Plugins - Whilst some plugins are awesome, some are surprisingly disappointing. While I was really looking forward to them, the following plugins just didn’t get as much use as I expected session (doesn’t work well with NERDTree or quickfix window), taglist (doesn’t work well with dynamic languages - at the moment I use primarily Ruby and Javascript), Conque Shell - (nice idea, but doesn’t feel natural, just easier to use
:shell
or have another terminal open)
Effort vs Reward
Ok. So I have a theory…
Vim proponents will tell you that the effort you spend learning vim will pay dividends in the long run once you know how to use it properly. After 60 days I can say that I agree with that opinion.
However, if I spent this much effort learning any editor I think it would pay dividends in the long run. The difference is that Vim forces you to go through this pain, whilst other editors work ‘out the box’ and so most programmers are not inclined to learn the power of those editors.
For example, I think UltraEdit, TextMate, even Visual Studio are pretty good editors, but since they all pretty much just work out of the box, its easy to ignore their advanced features and not spend the time customizing and configuring them.
I wonder if I spent 60 days really learning UltraEdit if I couldn’t get the same positives I described here ? Hmmm, a future article maybe?
Conclusion
I’m still using Vim after 60 days, and I plan to continue using it for the foreseeable future as long as I can keep taking a little time here and there to dig deeper, customize a bit more, learn how to overcome the negatives and build upon the positives.
Vim seems to be so powerful that I could be learning it forever. Here’s a list of some of the things I want to spend time on in the future.
- Movement - I need to learn more code related movement commands like % match
- Sessions - Both sessions.vim and sessionman.vim seem to struggle with NERDTree and the quickfix window
- Cut & Paste - I need to learn more about vim registers so I can manage my cut & paste better, errr, sorry, I mean yank & put
- Undo & Redo - I think I spend too much time in insert mode so when I undo it tends to be more than I’d like
- HJKL - Maybe I should remap to swap the J and K keys and try again!
- More Plugins - There are many more plugins I would like to take the time to check out, and perhaps build some of my own.
Check back in the new year of 2012 and maybe I’ll write up a ‘1 Year with Vim’ article for you!