Searching and replacing in emacs
Posté le mar. 04 avril 2017 dans blog
Day two of my serie about emacs, about searching and replacing.
- Function name: isearch-forward
- Typical Key binding:
C-s
- How to get help:
C-h f isearch-forward
isearch-forward let you type a string to be searched incrementally
in the current buffer, successive following C-s
will jump to the next
match.
- Function name: isearch-forward-regexp
- Typical Key sequence:
C-M-s
orC-u C-s
- How to get help :
C-h f isearch-forward-regexp
isearch-forward-regexp let you type a regexp to be searched
incrementally in the current buffer, successive following C-s
will
jump to the next match.
- Function name: query-replace
- Typical key binding:
M-%
- How to get help:
C-h f query-replace
- Usage:
M-%
searchRET
replaceRET
Then, for each term found, query-replace will ask you what to do:
space
or y
to replace, delete
or n
to skip, RET
or q
to
exit, !
for "yes for all", ?
to get help about how to enter
recursive edit / delete match and recursive edit / edit replacement
string / ... Then you should read about replace-string,
replace-regexp, occur, list-matching-lines, multi-occur,
multi-occur-in-matching-buffers, how-many, flush-lines, and
keep-lines.
Case sensitivity: A search is by defaut case
insensitive, but if you input an upper case letter, it become case
sensitive. M-c
during a search toggle the case
sensitivity. Configuration variables: You may consult the
documentation about those variable typing : C-h v *variable*
or M-x
apropos-variable RET case-fold-search RET
- case-fold-search (Non-nil if searches and matches should ignore case.)
- default-case-fold-search (Default value of `case-fold-search')
- tags-case-fold-search (Whether tags operations should be case-sensitive.)