Recommendation: I recommend you to try a similar package from the same author: outline-indent.el, which provides a minor mode for Emacs that enables code folding and outlining based on indentation levels for various indent-based text files such as YAML, Python, and others. In addition to code folding, it allows moving indented subtrees up/down, customizing the ellipsis, and inserting a heading that creates a new line with the same indentation level/depth as the current line, among other features.
Working with long and complex YAML files can be a daunting task. In such cases, code folding becomes an invaluable tool, allowing the collapse and expansion of sections of the file and enhancing readability and navigation. This makes it easier to focus on specific parts of the code without being overwhelmed by the entire document.
To address this need, I would like to introduce you to outline-yaml.el, a minor mode for Emacs that brings code folding and outlining capabilities to YAML files, making editing YAML files more efficient and enjoyable. Leveraging Emacs’ built-in outline-minor-mode
, outline-yaml.el
provides a structured and navigable view of YAML content, simplifying the editing of even the most difficult YAML files.
Installation of outline-yaml.el
- Install and configure yaml-mode or
yaml-ts-mode
. - If you haven’t already done so, add the straight.el bootstrap code to your init file.
- After that, add the following code to your Emacs init file:
(use-package outline-yaml
:ensure t
:straight (outline-yaml
:type git
:host github
:repo "jamescherti/outline-yaml.el")
:hook
((yaml-mode . outline-yaml-minor-mode)
(yaml-ts-mode . outline-yaml-minor-mode)))
Code language: Lisp (lisp)
How to change the Ellipsis (…) to (▼)?
The code snippet in this article can be used to to change the Ellipsis to ▼.