双引号的自动配对是一个非常奇怪的问题,我认为我已经解决了但仍然存在。问题是对于扩展名为 .php、.html 的文件,自动配对双引号的默认字体样式不可解析。为了向您展示我的意思,请注意<div>
左侧双引号的字体样式。而对于 .js 和 .css 文件,双引号自动配对具有正确的字体样式,如<div>
右侧 > 所示。
这一定是某个地方的设置,但我不太了解 Sublime Text2 (Mac OSX)。想法?
双引号的自动配对是一个非常奇怪的问题,我认为我已经解决了但仍然存在。问题是对于扩展名为 .php、.html 的文件,自动配对双引号的默认字体样式不可解析。为了向您展示我的意思,请注意<div>
左侧双引号的字体样式。而对于 .js 和 .css 文件,双引号自动配对具有正确的字体样式,如<div>
右侧 > 所示。
这一定是某个地方的设置,但我不太了解 Sublime Text2 (Mac OSX)。想法?
在@JamieJag 的巨大帮助下,我解决了这个问题。Shift+" 产生了 Sublime 所称的“印刷”引号,而不是可作为 PHP 或 HTML 代码的一部分解析的双引号。
为了解决这个问题,我注释掉了我的 SublimeText2 首选项->键绑定->用户中的所有内容。
我不清楚这些 JSON 对象中的一个或所有是否对有问题的行为负责(尽管我猜第一个 JSON 看起来像违规者)但到目前为止,仅注释掉整个数组就解决了我的问题。
/*[
// Auto-pair typographical 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": "selector", "operator": "equal", "operand": "text", "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 },
{ "key": "selector", "operator": "equal", "operand": "text", "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 },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
// Smart quotes before & after word
{ "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": "^\\S", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
},
{ "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": "preceding_text", "operator": "regex_contains", "operand": "^\\S", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text", "match_all": true }
]
}
]*/