On 29/11/08 04:54, Tim Johnson wrote:
> Using vim 7.1 (huge) on kubuntu 7.10
>
> Executing the following
> ?[\|(\|{
> Gives me the expected results. I.E.
> The cursor is placed at the closest previous '[' or '(' or '{'
>
> Executing the following
> /]\|)\|}
> Gives me the expected results. I.E.
> The cursor is placed on the closest next ']' or ')' or '}'
>
> Yet these two functions:
> function! PreviousDelimiter()
>       execute '?[\|(\|{'
>       execute ':nohls'
> endfunction
> " and
> function! PreviousDelimiter()
>       execute '?[\|(\|{'
>       execute ':nohls'
> endfunction
>
> yield unexpected results. In each case, when the function
> is called, the cursor is placed at the beginning of the line
> of the first successful match, rather than on the target char.
>
> Your help is appreciated and even moreso, pointers to
> discussions on the relevant subjects.
>
> Thanks
> Tim

":execute" runs its argument as an ex-command (the colon is unnecessary, 
but, as you can see by starting a command-line with two or more colons, 
it does no harm). In this case your search is run as a naked range, 
which puts the cursor at the start of the line so found. See ":help 
:range". Similarly, ":225" or ":exe 225" would put the cursor at the 
start of the 225th line.

You might try
        normal ?[\|(\|{
        nohls
instead.


Best regards,
Tony.
-- 
What good is having someone who can walk on water if you don't follow
in his footsteps?

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to