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?

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top