lk/vim/vim-search.md
2023-04-16 14:49:47 +02:00

415 B

title tags
vim search
Documentation
vim

Search for the next and or previous occurrence of the word under your cursor with * and #.

Search and replace the first 'one' found with 'two':

:%s/one/two/

Same, but replace 'one' globally:

:%s/one/two/g

Put quotes around every occurrence of $HOME:

:%s/$HOME/"&"

Same, but add curly brackets around $HOSTNAME:

:%s/$HOSTNAME/{&}