~ / blog / Fast track to being productive in Vim

Sat, May 02, 2015

When I first started using vim three months ago, I found it quite challenging to get meaningful work done. I now realize that there were a list of things I had to grok in order to be productive in vim. Learning vim can be extremely gratifying, but the core ideas in vim are also probably unlike anything you have seen before. I thought it would be useful to share some steps one could take to maximize productivity with vim after committing to it. I haven’t been using vim for very long so I’m by no means an expert, and I still learn new things about vim every day. That said, this is in my experience the best bang for buck in priority order.

  1. Spend half an hour (maybe over lunch) using vimtutor.
    • Type vimtutor in a command line window and follow instructions.
  2. Learn to stay in normal mode often.
    • If you want to make a change, enter insert mode, edit text and return to normal mode.
  3. Break old habits while learning new features by disabling functionality you are accustomed to.
    • For example, you can learn to navigate using hjkl by disabling arrow keys.
  4. Understand how to use macros:
    1. q : Start a macro
    2. [REG] : Assign a macro to a register, e.g. a. Starts recording a macro
    3. [keystrokes] : Perform a set of keystrokes, e.g. ciwhelloESC
    4. q : End recording a macro
    5. @[REG] : Play a macro from cursor current position
    6. @@ : Play last played macro
  5. Learn how to use and navigate buffers (:ls<CR>, :buffer N, C-^), jumplist (C-O, C-I), and taglist (C-], C-T).
  6. Learn about the built-in complete sub-mode: Use C-X in insert mode.
  7. “Craft your lightsaber” — make vim your own using ~/.vimrc.
    • Don’t be afraid to customize your editor, but also don’t add anything in your .vimrc that you don’t understand.
  8. Change CAPSLOCK to ESC.
  9. Watch other people use vim on vimcasts and on YouTube.
  10. Find plugins to boost your productivity, and use a plugin manager.