Tuesday, January 21, 2014

Vim - probably the greatest editor of all times

Such a title is of course only useable for one thing; starting a flame war. However, I'm back into coding big time, which make me discover new tricks and re-discover old tricks in vim. Most of this can be found other places around the net, so my point with this page is just to assemble some of the shortcuts, mappings, tricks and maybe packages that make up my vim environment. At the moment my main focus is backend development for a mobile/web solution, in Python.

This page is a published draft. Maybe I clean it up in time, but for now everything is random. I wrap key strokes in brackets, like [dd]

  • show contents of registers, for pasting, etc.: :display. It's an alias for :registers, and both :reg and :di can be used if you want it shorter.
  • use the "* register for setting/pasting system buffer. Actually works now on OS X (Mavericks, running MacVim 7.4)
  • Mapping [,,] to [ctrl-^is great for switching alternate buffers quickly.
  • Use the surround plugin (Bundle 'vim-scripts/surround.vim'). Then [csw'] can be used to enclose a word in quotes, [cswb] to wrap it in parenthesis, and so on.