On May 11, 2007, at 4:26 PM, A.J.Mechelynck wrote:

Simon Butler wrote:
Hi Tony, thx for getting back to me, my comments below:
On May 11, 2007, at 3:42 PM, A.J.Mechelynck wrote:
Simon Butler wrote:
hi, when i write this skill (cadence extension language) fragment in emacs i get the following:
procedure( vscCheckpointHier( @key lib cell view message inclibs )
    let(( ddCVs )
vscPrint0(sprintf( nil "Hierarchy for %s,%s,%s ..." lib cell view )) when( ddCVs = vscGetHierarchyDDs( ?lib lib ?cell cell ? view view
                                          ?inclibs inclibs )
vscPrint0(sprintf( nil " %d cellviews." length (ddCVs) ))
            vscCheckpoint( ddCVs ?message message)
        ); when ddCVs
    ); let
); procedure vscCheckpointHier
Notice all the comments placed on the closing brackets. Is there a way to make vim do this?
TIA

In Vimscript, IIUC what you mean, a comment starts with a double quote. Most statements accept a comment after them; a few don't, because they see the quote as part of their arguments. See ":help :quote". There is a workaround to add comments even after the commands (such as :map) which don't accept them (see ":help :comment"):

    exe 'map <F9> <C-]>' |" find tag under cursor


So you could do (not sure whether I read emacs syntax correctly, but the following should give you a notion of what is possible):

function vscCheckpointHere(key, lib, cell, view, message, inclibs)
    let ddCVS = vscPrint0(printf("Hierarchy for %s, %s, %s ...",
        \ a:lib, a:cell, a:view))
    if ddCVS == vscGetHierarchyDDs(a:lib, a:cell, a:view, a:inclibs)
let ddCVS = vscPrint0(printf(" %d cellviews.", length (ddCVS))
        call vsCheckpoint(a:message)
    endif " ddCVS
" endfunction vsCheckpointHere
endfunction

(I'm not sure whether or not a comment is allowed after ":endfunction", see ":help :endfunction")

how do i set this up? do i need something in my .vimrc?

The ability to use comments in vimscript (including in your vimrc) is part of Vim. You don't need to set up anything, except maybe write the comments when you write the code.


maybe i'm missing something here. my objective is not to write the comments by hand. they should appear automatically after the brackets, thats how skill mode in emacs is setup and i'd like to be able to do the same thing in vim


If your vim code is properly indented, you might also have less need for this kind of comments.

the indenting was correct when i send the email but the formatting changed by the time it made it to the list i guess
thx!

I mean: the differences between a C-like language like vimscript and a lisp-like language like emacs-script might perhaps make this kind of comments less necessary if the code is properly indented.


ok, but the code was properly indented. i still find the comments useful personally


thx again

Reply via email to