SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

RainbowDelimiters

RainbowDelimiters is a “rainbow parentheses”-like mode which highlights parens, brackets, and braces according to their depth. Each successive level is highlighted a different color. This makes it easy to spot matching delimiters, orient yourself in the code, and tell which statements are at the same depth.

Great care has been taken to make this mode fast. You shouldn’t see any change in scrolling or editing speed even with delimiter-rich languages like Clojure or EmacsLisp.

You can customize the color scheme RainbowDelimiters uses. The color scheme it comes with is intentionally subtle.

Download:

Setup instructions:

1. Download rainbow-delimiters.el from git and add it to your emacs load-path.

2. Byte-compile the file (necessary for speed):

M-x byte-compile-file <location of rainbow-delimiters.el>

3. Add the following to your dot-emacs/init file:

(require 'rainbow-delimiters)

4. Enable the mode in your dot-emacs/init file. You can either use it only in certain editing modes, or use it Emacs-wide:

- To use only with specific modes, add lines like the following:

(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)

- To enable in all programming-related modes (Emacs 24+):

(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)

- To use Emacs-wide, add this line:

(global-rainbow-delimiters-mode)

To toggle rainbow-delimiters mode while Emacs is running:

- In a single buffer: M-x rainbow-delimiters-mode

- Globally (all buffers): M-x global-rainbow-delimiters-mode

Customization:

To customize rainbow-delimiters mode, you can use:

M-x customize-group rainbow-delimiters

Color Scheme

customize-group rainbow-delimiters-faces has the faces for successive nested pairs of delimiters. You can change them through emacs customize or in your color theme or dot-emacs.

The face rainbow-delimiters-unmatched-face is used for unmatched closing delimiters.

Zenburn and Solarized themes have their own colors for these faces.

deftheme/color-theme.el: Further information is at the top of rainbow-delimiters.el.

Stop Highlighting Certain Delimiters

You can disable highlighting of any of the supported delimiter types through the customize interface, in the Toggle Delimiters section.

Other Information

Rainbow-delimiters comes with two default color schemes, for light and dark backgrounds. Emacs chooses which to used based on the value of variable ‘frame-background-mode’.

emacs-fu: toward balanced and colorful delimiters is a blog post describing rainbow-delimiters, including a screenshot using a different color theme.

Development Version/Contributing

The current development version is always at github, under jlr/rainbow-delimiters.

Reporting Issues

Please send any bug reports or requests to the github page.




CategoryFaces CategoryModes ParenthesesAppearance