How to quickly find → replace OR skip in Vim
The aim of this page📝 is to use an improved “dot formula” to run a quick find & change OR skip → next in vim
Jul 23, 2024
It comes from Drew Neil, as described in his wonderful Practical Vim.
- define exact match (ideally case sensitive with /C), but here just
SLOG
- make operation (c/d/y/gU/…) → enters operator pending mode
- press
gn
to operate on the next match (for change —cgn
)this combines action and moving to the next so that the repetition with the dot command is done with a single keystroke (.)
2+3 are pressed together in a typical operation+motion mode → you have just modified a match
Change-Next or Skip-Next?
- to skip press
n
- to operate on the next press a single
.
LINKS
http://vimcasts.org/episodes/operating-on-search-matches-using-gn/ https://vimhelp.org/visual.txt.html#gn