(Vim) Replace / replace with newlines
- Replace newlines to XX:
:%s/\n/XX/
- Replace the above
%
with a range to apply the replacements only to a specific range
- Replace the above
- Replace XX with newlines:
:%s/XX/\r/
- Replace the above
%
with a range to apply the replacements only to a specific range - Note the use of
\r
instead of\n
this time
- Replace the above
Reference:
Written on February 25, 2021