evil icon indicating copy to clipboard operation
evil copied to clipboard

Add code folding to the docs

Open nettoyoussef opened this issue 4 years ago • 1 comments

Issue type

  • Enhancement request

Environment

Not relevant.

Problem

Currently there is no information about folding or evil-fold-list in the docs (e.g, here or here).

Per this reddit thread it is possible to select a backend by editing evil-fold-list, such as this example:

(setq evil-fold-list
  `(((hs-minor-mode)
     :open-all   hs-show-all
     :close-all  hs-hide-all
     :toggle     hs-toggle-hiding
     :open       hs-show-block
     :open-rec   nil
     :close      hs-hide-block)
   )
)

or to add a hook to enable folding with a particular package (one of vdiff-mode, vdiff-3way-mode, hs-minor-mode, hide-ifdef-mode, outline-mode, origami-mode) in a particular mode:

(use-package evil
  :ensure t
  :hook
  ('prog-mode . #'hs-minor-mode)
  :config
  (evil-mode 1)
)

It would be nice to have this in the documentation somewhere.

nettoyoussef avatar Nov 12 '20 01:11 nettoyoussef

I agree more information about folding would be appropriate. Or any, really. Even emacs wiki seems to be lacking on this topic. In addition to the above, a simple introduction might be useful. Perhaps something like this:

Evil includes document folding commands:

evil-toggle-fold
evil-open-folds
evil-close-folds
evil-open-fold
evil-open-fold-rec
evil-close-fold

Each of these matches one of a set of folding commands, depending on which minor mode is active. For many major modes, turning on origami-mode or outline-minor-mode will enable folding via zc, zo, zm, and zr. For more information on associating new modes with the evil folding commands, see documentation for the evil-fold-list variable.

jvasile avatar Feb 22 '21 03:02 jvasile