Emacs Init: Auto Insert Closing Bracket (electric-pair-mode)
electric-pair-mode
New in Emacs 24 (Released 2012-06).
put this in your Emacs Init File:
;; auto close bracket insertion (electric-pair-mode 1)
electric-pair-mode, setup brackets
Exactly which brackets are paired depends on the buffer's Syntax Table, which usually is 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 '( (?\" . ?\") (?\{ . ?\})))
Emacs, Work with Brackets
- Emacs Init: Highlight Brackets
- Emacs Init: Auto Insert Closing Bracket (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 🚀
- Emacs: Navigate Lisp Code as Tree
- Emacs: Select Text Between Quotes 🚀
- Emacs: Xah Elisp Mode 📦