I need replace all ; to \n , but :%s/;/\n/gc
not works
The simplest way to perform a search and replace in Vim editor is using the slash and dot method. We can use the slash to search for a word, and then use the dot to replace it. This will highlight the first occurrence of the word “article”, and we can press the Enter key to jump to it.
Press l to move the cursor right and j to move the cursor down to get the cursor to the S. Then press i to "insert" and hit enter to create a new line. Then hit esc to stop inserting and :wq to save and quit. There are lots of basic vi command lists on the internet that might help.
3.206 Line That's why Vim always adds a newline by default (because, according to POSIX, it should always be there). It is not the only editor doing that. Gedit, the default text editor in GNOME, does the same exact thing.
See http://vim.wikia.com/wiki/Search_and_replace
When searching: \n is newline, \r is CR (carriage return = Ctrl-M = ^M)
When replacing: \r is newline, \n is a null byte (0x00).
You need to use \r
as the replacement instead: :%s/;/\r/gc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With