XVimProject / XVim

Xcode plugin for Vim keybindings
MIT License
5.16k stars 595 forks source link

Ranged substitute only replaces first occurrence #156

Open DarkDust opened 12 years ago

DarkDust commented 12 years ago

Recipe: Say you've got a text of 10 lines, each containing the word "foo" somewhere. Now enter :2,6s/foo/bar/

Expected result: In each of the lines 2–6 the first occurrence of foo should be changed to bar.

What's happening: Only the first foo is changed to bar, all remaining lines are not changed.

Using :2,6s/foo/bar/g works as expected and replaces all foos in lines 2–6.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

JugglerShu commented 12 years ago

Just as note, Actually I tried this to work correctly but it was a little complex. I know Vim does it but replacing each line without 'g' is not easy problem despite it looks easy. ( Consider if the pattern include '\n' to be replaced )

I hope someone here is good at such a little complex string processing...