vim visual block search/replace only replacing first occurrence on a line

regex, replace, vim

Solution

You've probably `:set gdefault`; this inverts the meaning of the `g` substitution flag. You can check where it got set via `:verbose set gdefault?` and temporarily turn it off via `:set nogdefault`, but you probably want to find the place where it got set and remove it from there.

Problem

I'm trying the following command in visual mode to attempt a global find/replace on a block of text :'<,'>s/red/green/g The text looks like this red red red blue red red red blue And the result green red red blue red red red blue Instead of what I am expecting with the g switch: green green green blue green green green blue Any idea what causes this behaviour? If it is default behaviour how do I make g really really global? Thanks

Original source