Question

How to add a comment in a snippet of the form

snippet function
        /*
         * === FUNCTION =====================================
         *        Name: ${1:name}
         * Description: ${2:description}
         * ==================================================
         */
         ${3:void} $1(${4:args}) {
         ${5}
         }

The latter seems not to work.

Was it helpful?

Solution

You're initial edit missed tabstop ${4}, that's why the snippet navigation stops after the void. (I guess that's what you mean by "the latter seems not to work"; please try to be more precise in the future.)


The following works for me in Vim 7.4.264, using my custom snipMate fork. I've replaced tab characters with \t, because SO doesn't show then right:

snippet function
\t/*
\t * === FUNCTION =====================================
\t *        Name: ${1:name}
\t * Description: ${2:description}
\t * ==================================================
\t */
\t${3:void} $1(${4:args}) {
\t${5}
\t}

If your "freeze" is an endless loop inside Vimscript, pressing Ctrl + C should abort it. You can then retry with verbose logging: Capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for suspect commands. You should be able to see the endless loop, and hopefully get ideas how to fix them. Unfortunately, the original snipMate isn't maintained any more, but some forks are alive. You may check out those; they might work better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top