2013-04-04 162 views
1

当我在我的Mac上选择一个单词(例如测试)并写入“或”时,Sublime Text 2删除单词,将其替换为“or”而不是获得“测试”或“测试”。 ()或{}我没有任何问题。自动配对的单引号和双引号在Sublime Text中不起作用

我想这与做:

{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"${0:$SELECTION}\""}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } 
    ] 
}, 

任何想法?我卸载崇高(删除包和插件),然后重新安装。问题仍然存在。

谢谢!

回答

0

您需要在Preferences->Settings-Default中将auto_match_enabled设置为true。

+0

我有“auto_match_enabled”:true。事实上,{}和()正在工作,我的问题与“and”有关。 – sdaza 2013-04-04 22:42:41

+0

有趣的是,你有没有为'shift +'设置任何键绑定?或者,也许用户设置文件覆盖auto_match_enabled? – bdiamante 2013-04-04 22:50:50

+0

什么都没有......我只是安装了崇高的,它不起作用... – sdaza 2013-04-04 22:57:44

0

这是我...

// Auto-pair quotes 
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, 
     { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, 
     { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, 
     { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true } 
    ] 
}, 
{ "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"${0:$SELECTION}\""}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } 
    ] 
}, 
{ "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, 
     { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true } 
    ] 
}, 
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, 
     { "key": "preceding_text", "operator": "regex_contains", "operand": "\"$", "match_all": true }, 
     { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true } 
    ] 
}, 

// Auto-pair single quotes 
{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, 
     { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, 
     { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, 
     { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true } 
    ] 
}, 
{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'${0:$SELECTION}'"}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } 
    ] 
}, 
{ "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, 
     { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true } 
    ] 
}, 
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": 
    [ 
     { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, 
     { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, 
     { "key": "preceding_text", "operator": "regex_contains", "operand": "'$", "match_all": true }, 
     { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true } 
    ] 
}, 
2

我发现这个问题。这与我的键盘语言偏好有关。我用西班牙语的“美国 - 国际电脑”来编写口音。当我使用“美国”时它工作得很好。