Weekly Emacs tip #15: Colour your brackets, braces, etc. with rainbow-delimiters
The rainbow-delimiters package contains a minor mode that highlights various sorts of brackets, braces, parentheses, etc. according to the depth in which they are nested. Obviously, this can be very helpful when editing lisp code (or your .emacs file), but I have also found it to be helpful in other languages, as shown in the screenshot below.
Figure 1: Screenshot of rainbow delimiters
Here’s my use-package declaration for it. The :defer t tells use-package to wait loading the package until it is needed. The :hook block makes sure the mode is loaded for prog-mode, from which basically all programming modes are derived. The inferior-ess-mode is used when interactively running R in Emacs.
;; Rainbow parentheses: https://github.com/Fanael/rainbow-delimiters (use-package rainbow-delimiters :defer t :hook (prog-mode . rainbow-delimiters-mode) (inferior-ess-mode . rainbow-delimiters-mode) )
Another language that can benefit from rainbow delimiters is LaTeX (which doesn’t derive from prog-mode IIRC). Simply add
(TeX-mode . rainbow-delimiters-mode)
to the :hook section to make this happen.
No Comments