On 07-Dec-2013 18:02 +0100, Hisashi T Fujinaka wrote:
> I have two columns of text and I just want to replace in one of the two
> columns. For example:
>
> foo-bar-grill foo-bar
> 2foo-bar-grill foo-bar
>
> and I just want to replace the second foo-bar with moose or something. I
> can visually select either column and then try a search and replace.
> Hitting : will prepopulate with "'<,'>" and so the line will look
> something like: "'<,'>s/foo-bar/moose/".
>
> No matter what column I select, only the first column gets changed.
>
> The only google help I get is from wikia and it talks about %V which
> doesn't work for me.
>
> Is this normal behavior?
Yes, it is, because :substitute always applies to entire lines of the
passed range, regardless of what was selected. You indeed have to use
\%V inside the pattern to further restrict the match:
'<,'>s/\%Vfoo-ba\%Vr/moose/
(or use the vis.vim plugin's :B command).
-- regards, ingo
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.