Applying a VIM macro to a set of lines

  1. Start a macro typing q + macro name (in that case was q as well)
  2. Record the commands. I was using ds' which uses the surround plugin to delete the quotes.
  3. Finish the recording with q again.
  4. Select the lines with V
  5. Apply the macro to the select lines with :norm! @q

Reference:

  • http://stackoverflow.com/questions/390174/in-vim-how-do-i-apply-a-macro-to-a-set-of-lines
  • https://github.com/tpope/vim-surround