How do I restrict a substitute command to only the text within my last visual selection using the percent-V atom?
:s/\%Vfoo/bar/
The \%V atom in Vim's regex engine matches only within the area of the last visual selection.
search #search #visual-mode #substitute #advanced #ex-commands