问题
TextMate 1 had a preference called "Auto-pair characters (quotes etc.)" that would allow you to enable or disable the auto pairing functionality.
Is it possible to disable this feature in TextMate 2?
回答1:
You can disable it for a given bundle as explained in this issue on GitHub.
Basically you have to edit an option file of the bundle and add smartTypingPairs = ( );
near the end of the file.
I don't know if this can be generalized using the .tm_properties
files but you are welcome to try (and report your results).
There is also a user defaults key for this:
defaults write com.macromates.TextMate disableTypingPairs -bool YES
回答2:
Automatic "Typing Pairs" is a TextMate 2 Hidden Setting
When you type an opening brace, parenthesis, quote character, or similar, TextMate will insert the closing character.
Disable via Terminal:
defaults write com.macromates.TextMate disableTypingPairs YES
回答3:
A follow-up for Ruby coders. After disabling auto-pairing, you'll still find that typing #
inside a double-quoted ("..."
) string expands to #{}
. If you want to disable this:
- "Bundles" menu -> "Edit Bundles..."
- Select "Ruby" in the left column
- Select "Other Actions" in the next column
- Select "Embedded Code - #{...}" in the third column
- Turn off the "Enable this item" checkbox in the drawer
- Type Cmd+S to save the updated bundle
Now you can type "#
without any auto-expansion/pairing. If you like typing #
and having the first {
appear but don't want the closing }
added, then instead of disabling the item, just edit in the bottom pane to remove the trailing }
:
#{${1:$TM_SELECTED_TEXT}
If you like selecting text within strings and typing #
to have it enclosed in #{...}
though, the above changed will make it quite awkward, so beware.
来源:https://stackoverflow.com/questions/14918534/disable-auto-pairing-of-characters-in-textmate-2