Monday, March 20, 2017

Re: Can I include /range/ in substitute pattern?

On Tuesday, March 14, 2017 at 10:28:23 AM UTC-7, Pablo Contreras wrote:

>
> my previous trick:
>
> :/kites/s//...... /
>
> doesn't work here because I'm trying to match both 'kites' and 'and bikes'
>
> Is this too ambitious?
>
> Thanks in advance! Pablo.

If you had searched /kites/ first, I'd suggest <C-r>/ to paste the search register, but clearly that isn't what you're after. If you do it that way,

/kites
:s/\(<C-r>/\)\(.*\)\(bikes\)/\3\2\1/

would shorthand typing kites (Just in case I'm not being clear about the key sequence here, <C-r>/ means ctrl+r then '/', and these are two commands, one to search and one to substitute)

That works for your example on my machine.


--
--
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: