On 03/25/2011 01:31 PM, [email protected] wrote:
I a function I a search (":/") at the last step.
:
But regardless how intense I define 'set hlsearch' --
when the function returns, the matches marked via hlsearch
are gone.

I'm not sure whether you do or don't want the highlighting, and if so, which thing you want highlighted.

If you want to preserve your original search, you can use

  function! Alpha()
    " ...
    let l:saved_search = @/
    /pattern/;
    let @/ = l:saved_search
    " ...
  endfunction

If you want to have the pattern from your function highlighted upon completion, the following hack worked for me:

  function! Beta()
    " ...
    /pattern/;
    set hls
    let @/ = @/
    " ...
  endfunction

I'm not sure if either of these are exactly what you're asking, but with a clearer understanding of (1) what was searched for before the function was called, (2) what was searched for in the function, and (3) what you expect to be highlighted at the completion of the function, it should be possible to concoct a solution.

-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

Reply via email to