- Notifications
You must be signed in to change notification settings - Fork197
Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
License
Fuco1/smartparens
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Table of Contents
Smartparens is a minor mode for dealing with pairs in Emacs.
It can automatically insert pairs:
wrap, unwrap and rewrap pairs:
expand and contract pairs:
navigate pairs:
and much more!
We generally target GNU Emacs version 25 and newer, however,everything should work mostly fine on anything newer than version 24.
You can install smartparens fromMELPA. Onceinstalled, enable thedefault configuration:
(require'smartparens-config)
You can now use smartparens withM-x smartparens-mode
. Toautomatically enable smartparens in a programming mode:
;; Always start smartparens mode in js-mode.(add-hook'js-mode-hook#'smartparens-mode)
You may want to trysmartparens-strict-mode
. This enforces thatpairs are always balanced, so commands likekill-line
keep your codewell-formed.
You can also useuse-package
to install and setupsmartparens
. An example config is:
(use-package smartparens:ensure smartparens;; install the package:hook (prog-mode text-mode markdown-mode);; add `smartparens-mode` to these hooks:config;; load default config (require'smartparens-config))
Inside Emacs,M-x sp-cheat-sheet
will show you all the commandsavailable, with examples.
There's also agreat article demonstrating movement and editing in smartparensandextensive documentation in the wiki.
We love pull requests. Please include tests. Smartparens usesert-runner for testing. Torun all the tests, run:
$ cask exec ert-runner
Alternatively, you can open the individual files in Emacs, thenM-x eval-buffer
M-x ert
.
You can learn more about how we test on thetesting wiki page.
Smartparens has a default configuration that works well for mostlanguages. For language-specific behaviour, smartparens has a separatesmartparens-FOO.el
file for every language andsmartparens-config.el
loads these automatically.
If you want to support this project, you can:
Contribute code. If you have an idea that is not yet implemented andwill benefit this project, feel free to implement it and submit apull request. If you have any concerns whether your contributionwill be accepted, ask beforehand. You can email the author orstart an issue onthe tracker.
Contribute ideas. Even if you can't code Emacs Lisp, you can stillcontribute valuable ideas for other programmers to implement. Simplystart new issueon the tracker and submit your suggestion.
You can make a financial donation throughPayPalorPatreon. If youlike smartparens and can spare a modest amount on a donation, feelfree to do so. These donations are expressions of your gratitudeand are used for my personal "rewards" (books, games, music etc.).You can also gift me a game onSteamor buy something onAmazon.Regardless of the donations, smartparens will always be free both asin beer and as in speech.
Other Emacs projects that deal with pairs include:
Smartparens aims to provide a superset of these features, in allprogramming languages.
About
Minor mode for Emacs that deals with parens pairs and tries to be smart about it.