Lets discuss it with an example replace “ace with face” without effecting the words like “replace”, “faced”
We can not achieve the above requirement by just one command. We will need to execute a series of commands using gvim regular expressions below.
(1) Remove at word boundary
:s\<ace\>:face:g
\< \> creates word boundary. Note: the above expression will not replace the words as first in the line or last word in the line.
(2) Remove the first word of any matching line.
Try following, to replace first words oat beginning of any line.
:s:^ace\>:face:
(3) To replace last words at end of line.
:s:\<ace$:face:
(4) To replace only word in a line.
:s:^ace$:face:
>> How to Remove highlights or color from text file? Simply do :nohls
>> How to Search in a text file ?
Simply do /<search_pattern>
Anything after / will be search pattern to find in file.
>> How to set Ignore case in text file for search? :set ic
>> How to open multiple files in GVIM?
Use :split <path_of_file>
>> How to switch between multiple files using only keyboard in GVIM editor?
When multiple files are open in gvim editor, use ctrl+w 2 times to jump in-between files.
>> How to merge the line with line below? Shift+j or capital J
>> How to change text to lowercase or uppercase?
gu{motion} - As you move the up/down arrows the lines will change to all lower case.
gU{motion} - As you move the up/down arrows the line will change to all upper case.