Hi Tim, sorry for the confusing input I sent...
Before I call the function, there is nothing searched but hls is set via .vimrc (I am on Linux). The function does sort a few lines of text, and the last thing, which the function performs is a search of certain keywords. After the funtino has returned control back to the user the matched keywords should be highlighted as if the user her-/himself did the search... Best regards, mcc Tim Chase <[email protected]> [11-03-25 20:08]: > 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 > -- 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
