Emacs: Insert Bracket Pairs, electric-pair-mode
electric-pair-mode
electric-pair-mode
- toggle auto insert of bracket pairs.
When on, typing any left bracket automatically insert the right matching bracket.
New in emacs 24. [see Emacs 24.1 Features (released 2012-06)]Exactly which brackets are paired depends on the buffer's Syntax Table, which usually are set by current Major Mode .
If you always want certain brackets be inserted in pairs, you can customize the variable electric-pair-pairs. Its value should be a Association List.
;; make electric-pair-mode work on more brackets (setq electric-pair-pairs '( (?\" . ?\") (?\{ . ?\})))
put this in your Emacs Init File:
;; auto close bracket insertion. New in emacs 24 (electric-pair-mode 1)
Emacs, Work with Brackets
- Emacs: Highlight Brackets
- Emacs: Insert Bracket Pairs, electric-pair-mode
- Emacs: Insert Brackets by Pair 🚀
- Emacs: Delete Brackets by Pair 🚀
- Emacs: Move Cursor to Bracket 🚀
- Emacs: Jump to Matching Bracket 🚀
- Emacs: Change Brackets/Quotes 🚀
- Emacs: Navigate Lisp Code as Tree
- Emacs: Select Line, between Quotes, Extend Selection 🚀
- Emacs: Xah Elisp Mode