TizzyTool
TizzyTool

Reputation: 253

Disable auto-pairing of characters in Textmate 2?

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?

Upvotes: 23

Views: 3811

Answers (3)

Andrew Hodgkinson
Andrew Hodgkinson

Reputation: 4779

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.

Upvotes: 0

pkamb
pkamb

Reputation: 35032

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

Upvotes: 11

Simon
Simon

Reputation: 32943

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

Upvotes: 30

Related Questions