Emacs 的功能类似于 JEdit 的缩进折叠模式?
JEdit 有一种模式(具体来说,折叠模式:缩进,在选项中),让您可以完全基于缩进折叠代码块。它不需要任何额外的配置,也不需要了解您正在使用的语言。
也就是说,如果您有这样的代码:
foo
bar
blah
oof
并且光标位于第二行或第三行,并且您告诉 JEdit 折叠,那么这两行将被隐藏。
我读过类似的 SO 问题,但我没有在 emacs 中找到任何“正常工作”的内容,对于任何缓冲区,就像 JEdit 的代码折叠那样。
我专门尝试过 Fold Dwim。这对我不起作用。由于某种原因,它会折叠到缓冲区的末尾,这是完全无用的。
Possible Duplicate:
Emacs equivalent of Vim's foldmethod = indent
JEdit has a mode (specifically, folding mode: indent, in Options) that lets you fold code blocks based purely on indentation. It does not require any additional configuration, or knowledge of the language you are using.
That is, if you have code like this:
foo
bar
blah
oof
and the cursor is on the second or third line, and you tell JEdit to fold, those two lines will be hidden.
I have read similar SO questions, but I haven't found anything in emacs that "just works", for any buffer, like JEdit's code folding does.
I have specifically tried Fold Dwim. It doesn't work for me. It folds right to the end of the buffer, for some reason, which is utterly useless.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一下次要模式折叠模式
Take a look at minor mode folding-mode
OutlineMinorMode 对我有用,尽管我只将它与 LaTeX 一起使用。据我所知,它不会根据缩进折叠(如果我错了,请有人纠正我),而是根据您配置为标记可折叠部分的关键字等折叠。
编辑:这看起来很相关。
OutlineMinorMode works for me, though I've only used it with LaTeX. AFAIK it won't fold based on indentation (someone correct me if I'm wrong please) but on keywords etc that you've configured as marking a foldable section.
Edit: This looks relevant.