Sunday, September 19, 2010

How to find and replace with a new line character in windows gvim?

How to find and replace with a new line character in windows gvim?

It is very easy to find and replace with a new line in windows gvim.  In linux EOL ie., "End Of Line"

character will be "\n" but in windows it is "\r\n".   "\r" character is called as carriage return. Just visualize

old type writer machine carriage return. Now when it comes to find and replace with a new line using

windows is by the following steps,

1)Go to command mode by pressing "Esc" key.
2)Find and replace with a carriage return instead of a new line character. ie.,

:s/SearchText/\r/gc


For linux users, find and replace with a new line. ie.,

:s/SearchText/\n/gc

No comments:

Post a Comment