我正在寻找一种方法来编写一个片段,让我包含另一个片段。以下是python函数代码段的示例:
def test(args):
${1:code here}
$(insert-snippet "not_implemented_exception")
在这个例子中,我想首先将一些内容写入字段#1中的python函数,然后点击TAB。点击TAB应该转到lisp位,我可以选择使用名称“not_implemented_exception”扩展代码段。
我尝试阅读源代码,但对于lisp来说却是新手,所以我没有发现任何使用。
答案 0 :(得分:1)
我认为您可以将文本“not_implemented_exception”设置为最后一个tabstop,因此您可以再次按TAB进行展开。
def test(args):
${1:code here}
not_implemented_exception$0
如果您不想将代码段放在最后,可以通过
启用嵌套代码段(setq yas-triggers-in-field t)