Today I Learned
How to search and replace within a range in vim
Posted on January 3, 2018

A quick “search and replace in vim” google search will likely result in vim command looking something like this:

%s/foo/bar/g

While useful, you may have a big file and want to restrict where you find and replace. The % operator can be omitted to search a single line, or be replaced with a range of lines, like so:

" Singe line
s/foo/bar/g 

" Range
1,5s/foo/bar/g