- [[vim]]
Search and replace word under cursor
- https://vim.fandom.com/wiki/Search_and_replace_the_word_under_the_cursor
To replace all `foo` with `bar`:
- place cursor on `foo`
- press `*` to search for the next occurrence
- type `ciw` then `bar` to change word
- press `n` to move to next occurrence (or `N` to previous occurrence)
- then press `.` to repeat
- then keep repeating `n.` to keep replacing
Search and replace within selection
- select text in visual mode
- press `:` to start typing a command (`:'<,>'` will show up, indicating the command will apply to the selection)
- type `s/search/replace/` and enter to replace
- to replace all matches, add `g` after third slash
- to confirm every replace, add `c` after the third slash
# References