Sunday, June 24, 2012

Re: How to use matcharg(2)[1] to set search register?

On 2012-06-24, Bee wrote:
> 2match has been set and is working.
>
> :echo matcharg(2)[1] returns the correct pattern.
>
> Why does this not set the search register?
>
> let @/=matcharg(2)[1]

It works for me.

Are you setting @/ within a function and expecting that setting to
persist after the function returns? That won't work because
functions use their own instances of @/.

Regards,
Gary

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

No comments:

Post a Comment