I remember the first career fair that Flatiron held, somebody asked a fellow student what their favorite vim shortcut was. When he admitted to not knowing what vim was, the potential employer turned around and walked away. It was a blessing in disguise. You don’t want to work for closed minded managers that would correlate knowledge of vim to programming potential. Nevertheless, the memory stuck in my head, and I wanted a chance to try for myself. Almost two years later, I’ve finally taken the plunge.
Why Use Vim?
The mouse or touchpad is bad. The single repetitive motion the mouse asks of you, carries tension all the way up to the base of your neck. I’ve tried countless ergonomic solutions. None have worked for me. I end up with a stiff neck and have to turn my whole body to talk to someone. The mouse is also SLOW. During my finance internship training years ago, they took the mouse away and had me build spreadsheets, timed. I love keyboard shortcuts and that’s all vim is. A text editor chock full of shortcuts. Oh yeah, and almost every computer has it built in already. No need to get a license and install. It’s open source! Tons of plugins at your disposal.
How I Made the Leap
Before I installed every plugin known the earth, I started with the bare basics. Borrowed heavily from @rheaton, you can copy my
.vimrc and plugin setup here. Follow the README for setup instructions.
Next, I ran
vimtutor straight from the command line for a great interactive tutorial. Vim Adventures is another great one to build up that muscle memory. And of course, I watched Upcase’s vim online tutorials
Shortcuts I use regularly
As you go along your normal text editing ways, you may notice yourself doing repetitive tasks. Write it down and google or ask someone if there’s a faster way via vim. Then add the shortcut to your cheat sheet. Pair programming also helps, by observing what shortcuts they use. Just like learning to type, the shortcuts will become part of your muscle memory. Here’s my list.
Ctrl + w + w: switch panes
Ctrl-w + s: horizontal splitting
Ctrl-w + v: vertical splitting
Ctrl-w + q: close pane
Search and/or Replace:
:%s/what i want replaced/newtext/gc
gis multiple times per line
gccinstead of gc if you don’t want to confirm
n: go to next match
N: go to previous match
h, j, k, l: your arrows on the home keys (for more daring fun, completely disable your arrows)
Ctrl + ^: beginning of line
Ctrl + $: end of line
w: until the start of the next word, EXCLUDING its first character
b: beginning of previous word
V: select whole lines
v: in select mode
Ctrl+ v: visual block mode, select vertically
- indenting multiple nested blocks: highlight block of text, then
~: toggles case
\: access nerd tree
m: nerd tree menu
shift + \,
shift + r: refresh nerd tree
There is something to be said of wisdom from experience. I’ve always been quick to jump into things, but I’ve come to realize, sometimes you need to slow down now, to be faster later. So just jump in and start doing it! It will take less than a month before you feel completely comfortable, which isn’t that long in the grand scheme of things.
This blog post can help get you started. My list above only scratches the surface of vim’s power. Very soon, you’ll be combining operators and motions, and tapping away blazingly fast!