我想用一条注释来结束我的 if 语句,指出 if 语句中检查的条件。我在 emacs 中使用 yasnippet,我使用的代码段是这样的:
# -*- mode: snippet -*-
# name: if
# key: if
# group : control structure
# --
if ${1:cond}:
$0
# endif $1
我的问题是最后的 # endif 评论与 对齐$0 .有没有办法让它与 if 语句保持一致?
最佳答案
yas-indent-line
的值控制这种行为。尝试添加
# expand-env: ((yas-indent-line 'fixed))
到标题。
关于emacs - 如何在python模式的yasnippet中删除一行的缩进?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27140607/