user4035
user4035

Reputation: 23749

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:

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

But when Emacs expands it, it generates an unwanted tab:

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). How to get rid of it?

Upvotes: 0

Views: 167

Answers (1)

Nicolas Dudebout
Nicolas Dudebout

Reputation: 9262

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
}
# }}}

Upvotes: 2

Related Questions