Skip to content
Matus Goljer edited this page Jan 15, 2013 · 3 revisions

When you type in a pair that smartparens auto-complete, it keeps the information about this pair in a special structure called overlay. These overlays can also accept text properties, which means they can be highlighted to inform the user that something "special" is going on. For example, while the overlay is active, the closing pair is automatically skipped if it is typed in (so as not to end up with (word)|)).

Similar technique is used for the partial wrapping overlays and tag insertion mode (used in wrapping with tags).

Smartparens uses its own faces (something similar to "css classes") to manage the colors and text properties. These are:

(defface sp-pair-overlay-face
  '((t (:background "#004a5d")))
  "The face used to highlight pair overlays."
  :group 'smartparens)

(defface sp-wrap-overlay-face
  '((t (:inherit sp-pair-overlay-face)))
  "The face used to highlight wrap overlays."
  :group 'smartparens)

(defface sp-wrap-tag-overlay-face
  '((t (:inherit sp-pair-overlay-face)))
  "The face used to highlight wrap tag overlays."
  :group 'smartparens)

The default values are set to be "pleasant" on the tango-dark color scheme. You can customize any of them using M-x customize-face name-of-face facility.

If you do not wish to have any highlightning at all, you can customize variables:

sp-highlight-pair-overlay
sp-highlight-wrap-overlay
sp-highlight-wrap-tag-overlay

and set them to nil (use M-x customize-variable name-of-variable). In that case, smartparens will not apply any face or text properties on the overlays, and will use them only for internal tracking purposes.

Another UI related feature is the show smartparens mode which highlights the "active" pair if the point is near the opening or closing delimiter.

Clone this wiki locally