emacs - 如何在python模式的yasnippet中删除一行的缩进?

标签 emacs yasnippet

我想用一条注释来结束我的 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/

相关文章:

Emacs 桌面保存模式启动错误

emacs - yasnippets 不适用于 javascript 模式

emacs - 将现有的 YAsnippet 模式指向新的文件类型

用于不同编码风格的 Emacs Yasnippet

c++ - Emacs、Cedet 和语义

c++ - C++11 lambda 函数的 Emacs 缩进(cc 模式)

emacs - 在当前 emacs session 中打开 LispBox

emacs - 阻止 emacs erc 重新居中

javascript - 在web模式下使用其他模式的yasnippets

emacs - 当 Yasnippet 宏可以触发时,如何触发事件?