If you want to insert new lines with sed-style regular expressions in vim, the usual '\n' doesn't work. The trick is to produce a '^M' by hitting Ctrl-V,Ctrl-M. For example:
:%s/word /word^M/g
will replace the space after the word "word" with a line break across the whole file.
2 comments:
Thank you! Already pulled my hairs out trying to figure out why \n\n wouldn't work! :D
Thanks!
Post a Comment