21

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?

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
TizzyTool
  • 233
  • 2
  • 5

3 Answers3

28

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
M. Justin
  • 14,487
  • 7
  • 91
  • 130
Simon
  • 31,675
  • 9
  • 80
  • 92
11

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
pkamb
  • 33,281
  • 23
  • 160
  • 191
0

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.

Andrew Hodgkinson
  • 4,379
  • 3
  • 33
  • 43