First things first: I used Vim briefly back in 2004 and 2005, in my early college days. I never learned how to use it properly, and had for years after written most of my code in Kate, Xcode, EditPlus, TextWrangler, TextMate, and Sublime Text.
Until last month.
At some point I realized that there would never be a good time for such a risky switch, in the sense that there would never be a convenient time to sacrifice productivity. I’ve always found that switching between modeless editors is relatively easy, but expected a shift to a modal one to have a fair share of bumps, and I’d gotten very accustomed to Sublime’s ample excellence. But after the above realization really sank in, on Friday, February 19th, 2016, I spent a bit of time setting up the fantastic Neovim and promised myself I’d try as much as I possibly could to use
l instead of the cursor keys.
That first day, and the ensuing weekend, and even the following week were all a bit rough. It was definitely different. However, as I persevered I got better and started discovering things organically. I’d highly recommend this approach — learn the very basics ahead of time, and get started. Once you feel like you’ve got a hang of those, you’ll want to discover more, probably specifically how to more efficiently move around the current buffer before anything else, and the plentiful resources online will let you pick things up piecemeal.
I’ve been doing that for six weeks now, and I love it.
I don’t know if they’re all that pro, but here are some transition tips:
Bookmark This Cheat Sheet
Don’t Go for Broke with Settings and Plugins
Especially if you’ve never really used a modal editor before, don’t try to get all your usual gizmos set up right away. There’s a lot of value to understanding what goes in your
.vimrc and how the settings change its behavior. There’s also a lot of value to thoroughly getting a grip on
shift-i, etc. before anything else. After all, you’re likely used to moving around with arrow keys or the mouse/touchpad, and your Vim experience will be far better in the long run if you don’t. Whic leads me to another point…
Try Your Best to Avoid Using Arrow Keys and the Mouse/Touchpad
It’s gonna’ be tough letting go of those old habits, but it’s worth it. Even on smaller keyboards, the arrow keys are just a bit far from where you want your fingers to be pretty much all the time, and moving your hand to another input device is even worse. Embrace the challenge of
l, and when it’s just not fast enough look at the EasyMotion plugin mentioned below. Also try
Go Cold Turkey
I’ve never had success half-assing a switch like this. Using Vim at home and Sublime at work only resulted in frustratingly slow progress and a low chance of success. Going all-in and committing to doing it and solving the inevitable quirks along the way worked far better and ended the frustration pretty quickly.
Sort Out Your Terminal First
This one I never thought about before. On OS X I’ve always used the built-in Terminal.app and I added tmux a year or so ago. That worked quite well for quite a while, but I decided to give iTerm 2 (v3 beta) a chance, and it’s been great. I spent some time finding a theme and font that make my eyes happy (and work well with my Vim theme), and it was a very worthwhile pursuit.
The Very Basics
Vim itself is pretty great and powerful already. Just these few lines in your
.vimrc will be plenty to start (adjust as needed, obviously):
syntax on " syntax highlighting set number " line numbers set tabstop=4 " tab is 4 spaces set shiftwidth=4 " << and >> change indentation with spaces set expandtab " tabs will actually be spaces set autoindent " automatic indenting
Even some of those may be optional, depending on your needs, abilities, and preferences. I don’t have a whole lot more in my
.vimrc aside from plugin-related settings.
If/once you’re comfortable with moving around and editing files in Vim, you’ll probably want to have a little more power at your fingertips. For that we turn to plugins.
This list is up-to-date as of today, but is absolutely evolving. I’ll try and remember to update this post if something drastically changes, but no promises.
My absolutely favorite Sublime feature was the fantastic fuzzy search. ctrlp.vim brings that to my Vim and it’s still my favorite editor feature. At work we use Django, and the rather large number of files would be very annoying to navigate without an easy way to get to any of them in a few keystrokes.
I generally try and keep my commits small, in the sense that they tend to be fairly segregated units of work. Since I work with all parts of Django, many of them end up involving a number of files, but perhaps only a few changes in each. Having an always-on per-line
git status is hugely useful. Highly recommended for any editor you use.
Excellent autocompletion. Completely worth the effort to get it all set up, and that’s from someone who’s never much cared for autocompletion in any editor.
A very clever way to move around within a Vim buffer. Rather than trying to explain it in words, I suggest you go look at the animated GIF in the project’s README.
A good status bar is worth its weight in gold. Handy Git info, flag for unsaved changes, row/column/percentage, etc.
Ack is great, and its searching power makes for a great complement to ctrlp.vim.
All the contributors to above plugins.
Thiago de Arruda for Neovim.
Bram Moolenaar for Vim.
Bill Joy for vi.
And the many, many people who’ve contributed to the entire world of free (as in speech) software whose work made this (and a lot of other things) possible.