/vanish.el

vanish.el: hide different parts of a buffer

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

vanish.el: hide different parts of a buffer

This package lets you define regions of text to hide, such as TBLFM lines and drawers, using regular expressions. It provides a minor mode, vanish-mode, and creates key bindings to toggle hiding the predefined parts of the buffer based on a configurable prefix (by default C-c v).

Demo

demo.mp4

Installation

Several options:

  • Download it directly and put it in your load-path

  • Use quelpa:

    (quelpa '(vanish :repo "thezeroalpha/vanish.el" :fetcher github))
    (require 'vanish)
  • Use use-package with quelpa-use-package:

    (use-package vanish
        :quelpa (vanish :repo "thezeroalpha/vanish.el" :fetcher github)
        :ensure nil)
  • Use whatever package manager you prefer, as long as you can install from a Github source

Configuration

After changing variables, disable and re-enable vanish-mode to update the keymap.

To change the vanish prefix from C-c v to e.g. C-c q h:

(custom-set-variables '(vanish-prefix (kbd "C-c q h") 'now))

To define additional parts of the buffer to hide, customize vanish-exprs. For example, for Elisp comments, you could add:

(add-to-list 'vanish-exprs 
    `(elispcomment . (:key ?c 
                      :name "Elisp comment" 
                      :start ,(rx bol (* blank) ";") 
                      :end ,(rx eol))))

Usage

Enable vanish-mode, then you can hide various parts of the buffer using (by default) C-c v KEY where KEY is a key defined in vanish-exprs. For example, with the default settings, you can hide #+TBLFM lines (used in Org mode) with C-c v f.