开发者

Inserting $1 in a snippet with snipMate

How can I insert a literal $1 in a snippet, using snipMate? I could not find that information in the manual…


Results in nothing (tries to find a placeholder):

snip开发者_StackOverflow社区pet s
    $1

Result in $ only:

snippet s
    $$1


I found a workaround. Use $${0:1}. SnipMate doesn't interpret ${0}, but seems to insert the default text instead.


Basically, you can't. The closest workaround is using default text:

snippet s
    $${1:1}

This requires you to hit tab once.

This is a listed issue with snipMate -- and has been for two years, so I wouldn't hold my breath waiting for it to get fixed.


I am currently on a promoting tour for UltiSnips on StackOverflow. UltiSnips support escaping chars, the corresponding snippet looks like this:

snippet s
\$1
endsnippet

A conversion script for snipMate snippets is shipped with UltiSnips, so switching is easy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜