Disable auto-pairing of characters in Textmate 2?

*爱你&永不变心* 提交于 2019-12-20 09:55:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!