From: "A.J.Mechelynck" <[EMAIL PROTECTED]>
Subject: Re: Terminating search in function
Date: Sun, 22 Oct 2006 09:33:01 +0200

> Meino Christian Cramer wrote:
> > Hi,
> > 
> >  I wrote this snippet:
> > 
> > "--------------------------------------------------------------------------------
> > fun! Ffunchdr()
> >     let date = strftime( "%F" )
> >     
> > put='/*-----------------------------------------------------------------------------*/'
> >     put='/**'
> >     put=' * desc'
> >     put=' *'
> >     put=' *'
> >     put=' *'
> >     put=' * Created: ' . date . '
> >     put=' *'
> >     put=' * parameter:
> >     put=' * parameter:
> >     put=' * parameter:
> >     put=' * parameter:
> >     put=' * parameter:
> >     put=' *'
> >     put=' * result 0 - Success, -1 - Failure'
> >     put=' *'
> >     put=' */'
> >     ?desc
> > endfun
> > command! Funchdr :call Ffunchdr()
> > 
> > 
> > 
> > This should give nme the header comment for function definitions in C.
> > My problem seems to be the "?desc" command at the end.
> > It /should/ move the cursor onto the "desc" keyword right in the
> > beginning of the comment block.
> > 
> > But it move the cursor to here:
> > 
> >           * desc 
> >           ^
> >           |
> >           cursor position
> > 
> > My """analysis""" (a too big word...) of the problem is: "?" is still
> > waiting for input. I tried
> > 
> > 
> >     ?desc<CR>
> > 
> > instead, but now "?" tries to find "desc<CR>" literally and did not
> > find it.
> > 
> > There seem to be an exception of the "type the commands as you would
> > do normally"-rule here...but what is the rule to recognize that the
> > current situation is an exception and what is the solution?
> > 
> > Thank you very much in advance for any help ! :)
> > 
> > Have a nice weekend!
> > mcc
> > 
> > 
> 
> What you're using is a "searching range" (as in ":?desc" from the keyboard). 
> It positions the cursor on the first nonblank in the matched line.
> 
> To use a "search command" (as in "?desc" from the keyboard) in an Ex-command 
> line, use ":normal":
> 
>       normal ?desc
> 
> see
>       :help :range
>       :help :normal
> 
> 
> Best regards,
> Tony.
> 

Hi Tony,

 :O) thank you,Tony !:O)

  
 execute "normal ?desc\<CR>"
 
 will do the job and it seems, that a final

 execute "normal cw" on the found "desc" cannot be done correctly,
 since the command is not finished (which it should eb according to
 the :help normal text).

 Have a nice weekend!
 mcc
  


 

Reply via email to