When cursor is on 'f',
<Plug>(operator-surround-replace)a'" will change above code to:
Note that the line has one trailing space at the end of line. So 'foo ' is modified to "foo" .
This occurs because replacing is implemented as a combination of deleting and appending a surround. It deletes the surrounding ' at first(foo ), and then appends surrounding " next("foo" ). When appending the surround, the space is not counted as surrounding and only 'foo' is considered as target.
When cursor is on 'f',
<Plug>(operator-surround-replace)a'"will change above code to:Note that the line has one trailing space at the end of line. So
'foo 'is modified to"foo".This occurs because replacing is implemented as a combination of deleting and appending a surround. It deletes the surrounding
'at first(foo), and then appends surrounding"next("foo"). When appending the surround, the space is not counted as surrounding and only 'foo' is considered as target.