6

我想用一个注释来结束我的 if 语句,该注释指示 if 语句中检查的条件。我将 yasnippet 与 emacs 一起使用,我使用的代码段是这样的:

# -*- mode: snippet -*-
# name: if
# key: if
# group : control structure
# --
if ${1:cond}:
    $0
# endif $1

我的问题是最后的#endif注释与$0对齐。有没有办法让它与 if 语句保持一致?

4

1 回答 1

10

的值yas-indent-line控制此行为。尝试添加

# expand-env: ((yas-indent-line 'fixed))

到标题。

于 2014-11-26T07:05:58.187 回答