Open seamyb88 opened 2 years ago
I'm facing a similar issue w/ PHP syntax. Let's say I have the following two snippets:
snippet foo
$this // this was created via foo
snippet bar
\$this // this was created via bar
They produce:
this // this was created via foo
$this // this was created via bar
Is this expected?
@karangb Yes that seems to be expected behavior. The snipmate docs mentions the second case but does not specify what should happen when the $
is not escaped:
Anywhere in a snippet, a backslash escapes the character following it,
regardless of whether that character is special or not. That is, '\a' will
always result in an 'a' in the output. A single backslash can be output by
using '\\'.
Also this issue seems to be fixed in https://github.com/honza/vim-snippets/blob/master/snippets/sh.snippets and can be closed @honza @seamyb88
I'm using neovim, if that's important. I'm also only talking about the SnipMate snippets.
The $ symbols which are intended to be inserted into the text need to be escaped in the snippet definitions for sh snippets.
For example in the getopt snippet, the line
echo "Usage : $${0:0} [options] [--]
should be
echo "Usage : \$${0:0} [options] [--]
and even those $ symbols which don't precede a tab stop require this also.