How do I get TextMate style quotes in Emacs?
-
09-06-2019 - |
Question
In textmate, when there's a current selection, I hit the " key and the selection gets surrounded by quotes. The same thing happens with other balanced characters like (, {, [ and '.
Am I missing something obvious in Emacs configuration that would enable similar behaviour when using transient mark mode, or do I need to break out elisp and write something?
Solution
OTHER TIPS
wrap-region.el from this guy's blog post will do what you're looking for.
Paredit will complete the TextMate-style quoting. When you type one part of a matched pair (quotes, brackets, parentheses, etc), the second will be inserted and the insertion point is moved between them, much like TextMate.
You should check out these older, very similar, questions:
Automatically closing braces in Emacs?
Emacs typeover skeleton-pair-insert-maybe
Although the correct answer is Joao's above; I'm about to go and change my answer to those questions, to point to autopair.