0

I just want to select 'folder*' and 'filename' to edit but I can't, below code does not work for me.
This file path with screenshot.

enter image description here

So I just try to write snippet code for 3 fields like below.

"\\\${1:folder1}\\\${2:folder2}\\\${3:filename}.jpg"

Second issue

enter image description here

I just try to write code for '0' (zero).
Thanks in advance.

Max-Enrik
  • 61
  • 13
  • 2
    It's not fully clear what you're trying to accomplish, but per the unofficial documentation on snippets, the project name variable is not one of the ones that can be inserted using a snippet; you would have to define your own custom command to be able to do that. http://docs.sublimetext.info/en/latest/extensibility/snippets.html – OdatNurd Dec 06 '16 at 06:05
  • I already read it, but I can't solve my issue, so I need to share screenshot and I hope it will help to shows my snippet issue. – Max-Enrik Dec 06 '16 at 21:18

1 Answers1

1

I'm going to assume you want a snippet to complete to what's shown in the screenshot. In that case your “code” does not work because you're escaping the $, which makes your snippet useless.

If you want to get a literal $, you have to escape it like this: \$.

Instead, you want to add another backslash to expand the snippet with two backslashes in place.

This following will expand with \\ and tab-stops in place:

<snippet>
    <content><![CDATA[
"\\\\${1:folder1}\\\\${2:folder2}\\\\${3:filename}.jpg"
]]></content>
</snippet>

Regarding your second issue: there are two ways to create tab-stops, with default values (e.g. ${1:default_value} and without (e.g. $1). So, you should use ${1:0} if you want it to contain 0 by default.

idleberg
  • 12,634
  • 7
  • 43
  • 70
  • Thanks so much more, you just clearly understand me. – Max-Enrik Dec 07 '16 at 18:55
  • _( I do not want to write basic snippet code )_ `${1:function}($210, $3name, $4false){}` I know I can write `${2:}10` But I am just wondering if I need to make tab-stops in place before numeric symbol, how can I write good code for it. – Max-Enrik Dec 07 '16 at 19:29
  • I just added second issue in main Question. – Max-Enrik Dec 07 '16 at 20:27