2013-04-04 57 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

我發現這個問題。這與我的鍵盤語言偏好有關。我用西班牙語的「美國 - 國際電腦」來編寫口音。當我使用「美國」時它工作得很好。