Tho*_*tep 39 emacs indentation
我正在尝试切换到Emacs作为我的主要源代码编辑器.我真的很想念一件事(在更简单的编辑器中很常见) - 缩进指南(显示缩进级别的不显眼的垂直线).Emacs能够显示它们吗?
ant*_*onj 78
我highlight-indentation
为此目的创建了一个函数,代码在github上.
在highlight-indentation
没有前缀参数的情况下调用时,当前缩进级别是从主模式(python,ruby和基于cc模式的语言)中天真猜测的.仅适用于空间缩进.自定义highlight-indent-face
以更改缩进线的外观.
示例(ruby,python):
我还经常使用这个代码片段来折叠大于当前行的缩进级别的所有代码.这是一个快速概述大纲的好方法.
(defun aj-toggle-fold ()
"Toggle fold all lines larger than indentation on current line"
(interactive)
(let ((col 1))
(save-excursion
(back-to-indentation)
(setq col (+ 1 (current-column)))
(set-selective-display
(if selective-display nil (or col 1))))))
(global-set-key [(M C i)] 'aj-toggle-fold)
Run Code Online (Sandbox Code Playgroud)