Thanks for the reply.

I have good news, and bad news:

The redraw thing only works if the search query (in my example,
"Change") is on the same page.  If you PigUp and PigDown away from it
before trying it out, the redraw thing doesn't take effect for the
potential highlights.

The good news is that a few people on Freenode #vim helped me
greatly.. and they provided me with this code that I stuck in
my .vimrc file, which so far seems to work in all cases without a
hitch:

" thanks to bairui, osse, and jamessan on Freenode for this
nmap <silent> <Leader>s :let @/ = input("highlight: ") <bar> set
hlsearch <CR>

On Apr 23, 4:00 pm, "Christian J. Robinson" <[email protected]> wrote:
> On Mon, 23 Apr 2012, smu johnson wrote:
> > As the subject suggestions, I can't get the search highlight to work
> > from inside a function.  If I run it myself using the colon command
> > and typing it in.. then it works.
>
> > function ChangeSearchRegister ()
> >  let @/ = "Change"
> >  set hlsearch
> > endfunction
>
> Adding a "redraw" line after the "set hlsearch" line in the function
> fixes the issue for me.
>
> - Christian
>
> --
>               Not to be taken internally, literally or seriously.
> Christian J. Robinson <[email protected]>      http://christianrobinson.name/

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

Raspunde prin e-mail lui