https://stackoverflow.com/questions/19994922/find-and-replace-strings-in-vim-on-multiple-lines Find each occurrence of 'foo' (in all lines), and replace it with 'bar'. :%s/foo/bar/g For specific lines: :6,10s/foo/bar/g