skip to main
|
skip to sidebar
Tech Notes
Monday, August 10, 2009
Inserting a newline when replacing text in Vim
Using \n to insert a newline when replacing text in Vim doesn't work, instead you need to use \r. This will not work as expected:
:s/foo/\n/g
But this will:
:s/foo/\r/g
Sources
http://stackoverflow.com/questions/71323/how-to-replace-a-character-for-a-newline-in-vim
http://stackoverflow.com/questions/71417/why-is-r-a-newline-for-vim
No comments:
Post a Comment
Newer Post
Older Post
Home
Search This Blog
About Me
Toro Hill
Freelance Web Developer.
http://karere.co.nz
http://accountaneer.com
View my complete profile
Labels
browsers
(3)
cli
(6)
DE
(1)
development
(5)
editors
(5)
filesystem
(6)
gui
(6)
hardware
(4)
images
(3)
linux
(25)
logs
(2)
mail
(1)
misc
(7)
music
(1)
network
(8)
pdfs
(4)
printing
(2)
security
(1)
sound
(2)
sync
(2)
web
(3)
windows
(12)
No comments:
Post a Comment