Question

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):

snippet s
    $1

Result in $ only:

snippet s
    $$1
Was it helpful?

Solution

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

OTHER TIPS

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.

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