简体   繁体   English

Emacs:如何摆脱perl-mode yasnippet中不需要的选项卡

[英]Emacs: how to get rid of the unwanted tab in perl-mode yasnippet

I have the following yasnippet in perl-mode to create a sub: 我在perl-mode中有以下yasnippet来创建一个sub:

#name : sub ... { ... }
#key: sub
# --
sub ${1:function_name}
# {{{
{
    $0
}
# }}}

But when Emacs expands it, it generates an unwanted tab: 但是当Emacs扩展它时,它会生成一个不需要的标签:

sub function_name
    # {{{ <-- ?
{

}
# }}}

I don't don't have this tab in the snippet definition, so it seems, that it is added by cperl-mode (perl-mode yasnippets are activated in cperl-mode). 我在片段定义中没有这个标签,所以看起来它是由cperl-mode添加的(perl-mode yasnippets在cperl-mode中被激活)。 How to get rid of it? 如何摆脱它?

When you insert a snippet, indentation is performed automatically. 插入代码段时,会自动执行缩进。 Add a line to your snippet to prevent this behavior as follows: 在代码段中添加一行以防止此行为,如下所示:

#name : sub ... { ... }
#key: sub
#expand-env: ((yas-indent-line 'fixed))
# --
sub ${1:function_name}
# {{{
{
    $0
}
# }}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM