Replace word in VIM
I want to replace a key word "BEGIN" to "LEFTCB", and "END" to "RIGHTCB" in a file by using VIM, so how to do it quickly?
cheers |
I got it now.
:rs/BEGIN/LEFTCB/a r - range, can be: nothing - work on the current line only number - work on the line whose number you give % - the whole file a - argument, can be: g - Replace all occurrences in the line. Without this, Vim replaces only the first occurrences in each line. i - Ignore case for the search pattern. I - Don't ignore case. c - Confirm each substitution. You can type y to substitute this match, n to skip this match, a to substitute this and all the remaining matches ("Yes to all"), and q to quit substitution. |
you could also try:
:%s/BEGIN/LEFTCB/g |
All times are GMT -5. The time now is 08:51 AM. |