【问题标题】:Emacs equivalent of Vim's foldmethod = indentEmacs 等效于 Vim 的 foldmethod = indent
【发布时间】:2010-09-27 19:43:11
【问题描述】:

问题: Emacs 是否有与 Vim 的 Folding with Foldmethod=indent 等效的规范?

我对可以与任何 Emacs 主要模式和任何文件一起工作的东西特别感兴趣。 Emacs 搜索还没有找到明确的答案。

【问题讨论】:

    标签: vim emacs editor folding outline


    【解决方案1】:

    似乎可以,虽然我自己不使用折叠,所以我没有尝试过。毫不奇怪,Python 的人都在关注这个特性。请参阅以下内容:

    【讨论】:

      【解决方案2】:

      可能是选择性显示?我将following function 绑定到 [f2]

      ;; http://emacs.wordpress.com/2007/01/16/quick-and-dirty-code-folding/
      (defun jao-toggle-selective-display (column)
        (interactive "P")
        (set-selective-display
         (if selective-display nil (or column 1))))
      

      不过,这很简单,你真的希望它对 Python 缩进敏感....

      更新:我昨晚盯着这个,意识到我厌倦了 C-u 进入我所在的列(加 1)......所以我把它编码了:

      (defun toggle-selective-display-column ()
        "set selective display fold everything greater than the current column, or toggle off if active"
        (interactive)
        (set-selective-display
         (if selective-display nil (or (+ (current-column) 1) 1))))
      

      进一步的阐述应该结合这两个功能。

      另见:How to achieve code folding effects in emacs

      【讨论】:

        【解决方案3】:

        我尝试了 Joe Casadonte 和 Michael Paulukonis 的所有建议,但没有一个能像 vim 的那样好用。因此,目前看来,对 OP 问题的更准确答案可能是否定的。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-05-29
          • 2011-07-09
          相关资源
          最近更新 更多