Mark Lucernas
2020-03-24

Vim Command Line Commands

Search and Replace

Search and Replace Multiple Files

Using :args, search all files from current directory recursively with I hate Vim characters and load all to Vim buffer.

:args `grep --recursive --files-with-matches 'I hate vim' .`

Shorter version

:args `grep -r -l 'I hate vim' .`

Using :argdo, replace all files loaded into buffer with I love vim

:argdo %s/I hate vim/I love vim/g | update


Resources