Forum Moderators: open

Message Too Old, No Replies

Vi - Search and Replace - adding new lines

:%s/pattern/\npattern/g ... but I get ^@?

         

gethan

11:01 pm on Feb 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



After much searching and even reading bits of the manual... I give up... I want to do this:

:%s/pattern/\npattern/g

Where \n will start a new line... I'd really thought this would work but I get ^@ instead... any ideas how to do this properly?

gethan

10:30 am on Feb 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I found a work around.. (possibly the correct way... but I doubt it)

when building the string in Gvim - hit ctrl+v then tap return (enter) this pastes in a ^M which is actually a newline character. Worked for me.