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.

Reply via email to