On Jul 26, 9:00 am, Ben Fritz <[email protected]> wrote:
>Change your function call to (untested):
>:set hlsearch | call Find("hello") | let @/=@/
It works just fine, no need for let @/=@/
This is already in the function:
let @/ = pattern
>But it looks like your function does nothing but search for the string passed
>in. What's it's purpose?
No, I mentioned at the beginning of the first post, the function
MODIFIES the passed in string. I did not include the code to modify
the string, only a comment:
" build search pattern based on str
I needed to be more clear. The passed in strings always will have a
similar modification, so rather than type those parts, I made a
function to pre- and ap-pend the other text.
>Vim provides the search() function to do the same thing.
Thank you, I thought there should be such a function, but did not find
it. I am still learning to use :help.
:help 'blah'
:help :blah
:help blah
:help blah()
And, yes, using search() would be simpler.
let @/ = pattern
call histadd("search",pattern)
call search(pattern)
But still needs :set hlsearch
Remembering that I had previously used 2match, I have replaced:
let @/ = pattern
try
execute "normal /" . pattern . "\<cr>"
catch
endtry
With:
let @/ = pattern
call histadd("search",pattern)
execute "2match User1 /" . pattern . "/"
On Jul 25, 10:20 pm, "Christian Brabandt" <[email protected]> wrote:
>I would simply use the matchadd() function.
Something like this WILL be useful in the future:
let @/ = pattern
call histadd("search",pattern)
let g:m = matchadd("User1",pattern)
Both do just what I want.
Both do their own highlighting, so the :set hlsearch is a non-issue.
Many thanks to Ben and Christian for helpful suggestions.
Bill
--
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