How to achieve code folding effects in Emacs?

后端 未结 14 2225
眼角桃花
眼角桃花 2020-11-30 16:15

Whats the best way to achieve something like code folding, or the type of cycling that org-mode uses. What would be the best solution in elisp to create this type of behavi

14条回答
  •  清歌不尽
    2020-11-30 16:43

    vimish-fold is also a nice and easy solution.

    https://github.com/mrkkrp/vimish-fold.

    From the homepage:

    This is a package to perform text folding like in Vim. It has the following features:

    • folding of active regions;
    • good visual feedback: it's obvious which part of text is folded;
    • persistence by default: when you close file your folds don't disappear;
    • persistence scales well, you can work on hundreds of files with lots of folds without adverse effects;
    • it doesn't break indentation or something;
    • folds can be toggled from folded state to unfolded and back very easily;
    • quick navigation between existing folds;
    • you can use mouse to unfold folds (good for beginners and not only for them);
    • for fans of avy package: you can use avy to fold text with minimal number of key strokes!

    Using the excellent use-package I install and activate it using this snippet in my config:

    (use-package vimish-fold
      :ensure t
      :config (vimish-fold-global-mode t))
    

提交回复
热议问题