, , , , Posted on 24 March 2025 by

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.

Screenshot rainbow delimiters.png

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

Let us keep you updated!

Once a month we’ll send you an overview of our newest articles. No spam, we promise.

Thank you for signing up! We've send you an confirmation mail.