有没有办法在 emacs 中为 python 代码提升一级缩进?
def foo():
...
def bar(): # if I'm here, is there a way to go to def foo?
pass
最佳答案
使用 python-mode.el 分别调用 M-x py-up RET 。 C-M-u
它会首先跳转到“def bar”的开头,然后向上进行第二次调用。
它的文档字符串说:
(向上py和可选缩进)
如果在内部,则向上或到表格开头。
如果在分隔形式 --string 或 list-- 内,则转到它的开头。
如果不在语句或 block 的开头,则转到它的开头。
如果位于语句或 block 的开头,则转到复合语句或定义所在位置的上一级开头。
关于python - 在 emacs 中将 python 代码提升一级?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19637475/