Today I Learned

hashrocket A Hashrocket project

Running same Vim command into multiple lines

We can run the same vim command for multiple lines using the norm, like:

:%norm cs'"

This will replace every single quote with double quote:

  • % => for every line
  • norm => repeat the following command in normal mode
  • c => change
  • s => surround
  • ' => delimiter char, in this case single quote
  • " => replaced char, in this case double quote
See More #vim TILs
Every developer at Hashrocket is a Vim expert. Check out our development environment, Dotmatrix, and if you are in Chicago, come to the Vim Chicago Meetup hosted at our Chicago office.