Sublimetext2 我怎样才能写;“动态”;崇高文本中的片段?
假设我的代码是这样的:Sublimetext2 我怎样才能写;“动态”;崇高文本中的片段?,sublimetext2,sublimetext3,sublimetext,sublime-text-plugin,Sublimetext2,Sublimetext3,Sublimetext,Sublime Text Plugin,假设我的代码是这样的: datatype type_name = | a of () | b of () ... // more 我是否可以在每次按tab键时生成()的|${place\u holder}对 我当前的代码片段是: <snippet> <content><![CDATA[ datatype ${1:type_name} = | ${2} of (${3}) ${4} ]]></content> <
datatype type_name =
| a of ()
| b of ()
... // more
我是否可以在每次按tab键时生成()的|${place\u holder}
对
我当前的代码片段是:
<snippet>
<content><![CDATA[
datatype ${1:type_name} =
| ${2} of (${3})
${4}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>dat</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.ats</scope>
</snippet>
dat
source.ats
但是正如你所看到的,当用户第四次点击标签时,我无法生成另一个|of()
对。选择第四个字段时,按空格键任意次数
<snippet>
<content><![CDATA[
datatype ${1:type_name} =
| ${2} of (${3})
${4:(spacebar)}
${4/ /| a of ()\n\t/g}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>dat</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.python</scope>
</snippet>
dat
source.python
通过$PARAM环境变量可能有一个更优雅的解决方案:您可以将一个整数传递给insertSnippet,并使用该整数通过上面显示的替换示例构造替换文本。不幸的是,文档没有提供有关$PARAM的信息。还提供了一个有关如何传递参数的有用示例。这里有一个使用替换的(不雅观的)hack。选择第四个字段时,按空格键任意次数
<snippet>
<content><![CDATA[
datatype ${1:type_name} =
| ${2} of (${3})
${4:(spacebar)}
${4/ /| a of ()\n\t/g}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>dat</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.python</scope>
</snippet>
dat
source.python
通过$PARAM环境变量可能有一个更优雅的解决方案:您可以将一个整数传递给insertSnippet,并使用该整数通过上面显示的替换示例构造替换文本。不幸的是,文档没有提供有关$PARAM的信息。还提供了一个有关如何传递参数的有用示例。为什么不将(${2})的
${1}
分配给键盘快捷键?为什么不将(${2})的${1}分配给键盘快捷键?