I wanna write a snippet like this:
snippet code
``` ${1:ruby}
```
but `` is used to wrap script command, how could I make it?
Thanks all !
I wanna write a snippet like this:
snippet code
``` ${1:ruby}
```
but `` is used to wrap script command, how could I make it?
Thanks all !
Newer versions of snipMate allow for escaping backticks:
snippet code
\`\`\` ${1:ruby}
\`\`\`
You should have mentioned which snippet plugin you're using. I'm assuming the original snipMate, because that one doesn't handle escaped backticks.
You can work around this with a Vim expression which yields the backtick:
snippet backtick
`!v nr2char(96)`
In your case, I would use
snippet code
`!v repeat(nr2char(96),3)` ${1:ruby}
`!v repeat(nr2char(96),3)`
repeat(nr2char(96),3) in vim, my code is :echo repeat(nr2char(96),3), it worked but When I added your code in my markdown.snippets without the echo,and adjust indents, it comes out invalid expression!v added by your edit presumably is extended UltiSnips syntax, right?! I don't mind the edit; users should figure this out, and probably UltiSnips is more commonplace by now.endsnippet at the end of snippetThe original snipMate as found on vim.org in version 0.83 doesn't allow escaping of backticks. However, version 0.84 in the abandoned repository seems to have it (cp. commit b2937829). It might be worth a try.
Alternatively, I have separately added that enhancement to my personal fork; unfortunately, it's mixed in there with many customizations and stuff that will not suit you. (But you could theoretically extract a patch from the list of commits.)
Maybe it's best to move to another, more modern and maintained snippet plugin. UltiSnips - The ultimate snippet solution for python enabled Vim is currently en vogue (but requires Python support).