On Jul 25, 9:18 pm, Bee <[email protected]> wrote: > I created a function that given a string will modify it to make a > search pattern. > > fu! Find(str) > " build search pattern based on str > let @/ = pattern > try > execute "normal /" . pattern . "\<cr>" > catch > endtry > endf > > It works very well. > > When I use the 'normal' find, I have it set to highlight all found. > > When I use the function the pattern is found but not highlighted. If > ':set hls' is added IN the function the found text is still NOT > highlighted. When 'n' is used to find the next occurrence... THEN the > text is highlighted. > > I can use a command like this to turn on highlighting, then call the > function and that works. > > set hlsearch | call Find("hello") > > Is there a way to turn on highlighting within the function? > > Bill
I forgot to say that I know the following from :help :function *function-search-undo* The last used search pattern and the redo command "." will not be changed by the function. This also implies that the effect of |:nohlsearch| is undone when the function returns. -- 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
