home ~ projects ~ socials

Find And Replace On Multiple Lines In Neovim

:.,+4s/foo/bar/g
  • : is the start of the prompt
  • . is the current line
  • , is the separator between lines
  • +4 gets the next four lines (for five total)
  • s/foo/bar/ is the seach/replace pattern
  • g sets to global so all lines are processed
:[range]s/{pattern}/{string}/[flags] [count]
-- end of line --