In Textmate I can wrap enclosing characters ('(', '[', '"', etc.) around text by selecting it and hitting the opening character. For example, if I select word
and hit (
, it will become (word)
. What does Emacs call this feature and how do I enable it?
相关问题
- Symbol's function definition is void: declare-
- How can I set the SVN password with Emacs 23.1 bui
- Emacs shell: save commit message
- How to change the first two uppercase characters o
- emacs bind key to the insertion of another
相关文章
- ess-rdired: I get this error “no ESS process is as
- Emacs/xterm color annoyance on Linux
- Pipe less to Emacs
- Capturing the output of “diff” with org-babel
- emacs terminal mode: how to copy and paste efficie
- How to permanently enable the hs-minor-mode in ema
- How do I use a shortcut to comment out code automa
- Pipe emacs shell output to a new buffer
For parens you can do M-(. For brackets/braces/quotes you could do:
Note that if you don't have a region highlighted, it will just insert the pair of whatevers and put the cursor in between them. Also handy for deleting matching whatevers is
EDIT:
Good point in the comments about overriding
backward-paragraph
. You could bind it to C-{, which might interfere with something in a major mode.insert-pair
takes the last key and does a lookup to see what pair to insert, so if you don't want to bind it to something-{ you could bind to this function instead:You can have a look at wrap-region.
I use http://www.emacswiki.org/emacs/ParEdit. M-( does exactly this.
I'd take a look also at skeleton-mode http://ggorjan.blogspot.com/2007/05/skeleton-pair-mode-in-emacs.html
It's very flexible expecially for parentheses.
Autopair is the best one of these tools
https://github.com/capitaomorte/autopair
There's now Corral as well. Its "do what I mean" behavior makes this process a lot faster than manually selecting the text and hitting the key.
(disclaimer: I'm the author)