links: 010 Vim MOC
Just for search
:/<search_string>Find next/previous occurrence
- Press enter and then
nfor next occurrence andNfor previous occurrence
Clear last search highlighting
:nohto turn off highlighting until the next search
Search and replace syntax
:%s/<search_string>/<replace_string>/command_flag
:%s/foo/bar/g
## replaces all occurences of foo to bar in a file
:%s/foo/bar/gc
## asks on each occurence whether to replace or not
:%s/foo/bar/gci
## case insensitive
:36,42s/foo/bar/g
## replace all occurences of foo to bar from line 36 to 42