Difference between revisions of "Folding"

From WikEmacs
Jump to navigation Jump to search
m (add screen)
(fold this region)
Line 20: Line 20:
  
 
[https://github.com/gregsexton/origami.el origami] works well with languages that use braces to delimit blocks.
 
[https://github.com/gregsexton/origami.el origami] works well with languages that use braces to delimit blocks.
 +
 +
== Fold this region ==
 +
 +
To fold the active region, see [https://github.com/magnars/fold-this.el fold-this] (in Melpa).
  
 
[[File:yafolding.png]]
 
[[File:yafolding.png]]

Revision as of 09:57, 4 March 2015

Folding is a way to hide and show text in an emacs buffer, i.e. to do code folding. For example, we can do the same thing than with org-mode but with source code.

You may look at the differences between narrowing and hiding text in Emacs : http://wikemacs.org/index.php/Emacs_Terminology#Narrow_and_widen

Outline-minor-mode

outline is a built in mode to cycle visibility and edit the code structure. You should check it out !

Evil users

evil-mode users also have a built-in solution: use za to toggle visibility, zc (close), zm (close all), zr (open all).

Third party packages

Yafolding

yafolding, in melpa, is based on indentation.

Origami

origami works well with languages that use braces to delimit blocks.

Fold this region

To fold the active region, see fold-this (in Melpa).

Yafolding.png