Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
Emacs Lisp Shell
Failed to load latest commit information.
docs Fix the documentation index Sep 25, 2016
images Reworking README to showcase best features. Dec 12, 2015
test [Fix #708] Remove provide from test-helper Feb 20, 2017
.gitignore Add sphinx documentation Sep 18, 2016
.travis.yml Test against 25.1 and trunk too Dec 31, 2016
Cask Add basic elixir-lang support (#695) Jan 28, 2017
LICENSE [Issue #295] Add LICENSE Feb 4, 2014
README.md Better badge organization Nov 11, 2016
make-release.sh [Fix #662] Add release script Nov 5, 2016
smartparens-clojure.el Match "`" with "`" in Clojure-related modes Oct 15, 2016
smartparens-config.el [Fix #698] Autoload clojure config. Jan 28, 2017
smartparens-elixir.el Added some missing special forms for the Elixir mode (#700) Jan 29, 2017
smartparens-ess.el Prefix handling for ESS Sep 18, 2016
smartparens-haskell.el Use `comint-last-prompt' in smartparens-haskell Oct 27, 2015
smartparens-html.el Update copyright notice to include year 2014 Jan 10, 2014
smartparens-latex.el Add LaTeX-mode to latex config Nov 5, 2016
smartparens-lua.el Don't autocomplete the lua blocks when inside comments (#648) Sep 26, 2016
smartparens-ocaml.el smartparens for OCaml Nov 5, 2016
smartparens-pkg.el Release 1.9.0 Nov 5, 2016
smartparens-python.el Use sp-in-string-quotes-p instead of sp-python-in-string-p Sep 25, 2016
smartparens-racket.el Add configuration for racket modes Oct 27, 2015
smartparens-ruby.el [Fix #638] Fix ruby pre and post handlers to process tabs properly Jan 4, 2017
smartparens-rust.el Support < and > in Rust with strict mode. Jan 1, 2017
smartparens-scala.el changes after review of PR Jul 10, 2015
smartparens.el Fix backward-delete hang in comint when at end of last prompt (#694) Feb 9, 2017
smartparens.org Updated docs Nov 20, 2012



MELPA Documentation Status MELPA Stable Documentation Status Build Status Coverage Status Paypal logo

Table of Contents

Smartparens is a minor mode for dealing with pairs in Emacs.

It can automatically insert pairs:

smartparens insert

wrap, unwrap and rewrap pairs:

smartparens wrapping

expand and contract pairs:

smartparens slurping

navigate pairs:

smartparens navigating

and much more!

Getting Started

We generally target GNU Emacs version 24.3 and newer, however, everything should work mostly fine on anything newer than version 24.

You can install smartparens from MELPA. Once installed, enable the default configuration:

(require 'smartparens-config)

You can now use smartparens with M-x smartparens-mode. To automatically enable smartparens in a programming mode:

;; Always start smartparens mode in js-mode.
(add-hook 'js-mode-hook #'smartparens-mode)

You may want to try smartparens-strict-mode. This enforces that pairs are always balanced, so commands like kill-line keep your code well-formed.


Inside Emacs, M-x sp-cheat-sheet will show you all the commands available, with examples.

There's also a great article demonstrating movement and editing in smartparens and extensive documentation in the wiki.


We love pull requests. Please include tests. Smartparens uses ert-runner for testing. To run all the tests, run:

$ cask exec ert-runner

Alternatively, you can open the individual files in Emacs, then M-x eval-buffer M-x ert.

There are also some ecukes tests, but these are deprecated.

You can learn more about how we test on the testing wiki page.

Language Support

Smartparens has a default configuration that works well for most languages. For language-specific behaviour, smartparens has a separate smartparens-FOO.el file for every language and smartparens-config.el loads these automatically.

Supporting Smartparens

If you want to support this project, you can:

  • Contribute code. If you have an idea that is not yet implemented and will benefit this project, feel free to implement it and submit a pull request. If you have any concerns whether your contribution will be accepted, ask beforehand. You can email the author or start an issue on the tracker.

  • Contribute ideas. Even if you can't code Emacs Lisp, you can still contribute valuable ideas for other programmers to implement. Simply start new issue on the tracker and submit your suggestion.

  • You can make a financial donation through PayPal or Patreon. If you like smartparens and can spare a modest amount on a donation, feel free to do so. These donations are expressions of your gratitude and are used for my personal "rewards" (books, games, music etc.). You can also gift me a game on Steam or buy something on Amazon. Regardless of the donations, smartparens will always be free both as in beer and as in speech.

Related Projects

Other Emacs projects that deal with pairs include:

Smartparens aims to provide a superset of these features, in all programming languages.