vip: Searching and Replacing
2.8 Searching and Replacing
===========================
Following commands are available for searching and replacing.
‘/ STRING <RET>’
Search the first occurrence of the string STRING forward starting
from point. Given a count N, the N-th occurrence of STRING will be
searched. If the variable ‘vip-re-search’ has value ‘t’ then
“regular expression” search is done and the string matching the
regular expression STRING is found. If you give an empty string as
STRING then the search mode will change from vanilla search to
regular expression search and vice versa (‘vip-search-forward’).
‘? STRING <RET>’
Same as ‘/’, except that search is done backward
(‘vip-search-backward’).
‘n’
Search the previous search pattern in the same direction as before
(‘vip-search-next’).
‘N’
Search the previous search pattern in the opposite direction
(‘vip-search-Next’).
‘C-s’
Search forward incrementally. See GNU Emacs Manual for details
(‘isearch-forward’).
‘C-r’
Search backward incrementally (‘isearch-backward’).
‘R STRING RET NEWSTRING’
There are two modes of replacement, “vanilla” and “regular
expression”. If the mode is vanilla you will get a prompt ‘Replace
string:’, and if the mode is regular expression you will ge a
prompt ‘Replace regexp:’. The mode is initially vanilla, but you
can toggle these modes by giving a null string as STRING. If the
mode is vanilla, this command replaces every occurrence of STRING
with NEWSTRING. If the mode is regular expression, STRING is
treated as a regular expression and every string matching the
regular expression is replaced with NEWSTRING
(‘vip-replace-string’).
‘Q STRING RET NEWSTRING’
Same as ‘R’ except that you will be asked form confirmation before
each replacement
(‘vip-query-replace’).
‘r CH’
Replace the character point is looking at by the character CH.
Give count, replace that many characters by CH
(‘vip-replace-char’).
The commands ‘/’ and ‘?’ mark point before move, so that you can return
to the original point by ‘` `’.