Wednesday, February 21, 2018

Re: Visual + global substitution on part of a line replaces every occurance, even outside the selected region

On 2018-02-22 04:25, David Woodfall wrote:
> If I visually highlight part of a line and do a substitution
> using /g it replaces every occurrence in the line, even outside the
> visual range.
>
> Is there a way around this?

You want the "\%V" atom:

:help /\%V

so you'd search for

/\%Vpattern\%V

(you can omit one or the other if you only care whether it
starts/ends within the visual region)

-tim


--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: