Monday, March 11, 2019

Re: setting v:searchforward from a motion operator

Am 07.03.2019 um 21:32 schrieb John Passaro:
> The mapping is implemented essentially like this:
>
> nmap <silent> =* :<C-U>set operatorfunc=SetSearchPattern<CR>g@
>
> This function sets the search pattern @/ and does a couple of other
> things. If I set v:searchforward inside it, the assignment is
> ignored.

Maybe you can set v:searchforward before invoking SetSearchPattern() (?):


nnoremap <expr><silent> =* ':<C-U>'. SetupSearchPatCmd(). '<CR>g@'

func! SetupSearchPatCmd()
return "set operatorfunc=SetSearchPattern|let v:searchforward = 1"
endfunc

--
Andy

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

Post a Comment