Sublime Text 2双引号字体样式取决于文件扩展名?

时间:2013-02-19 14:46:45

标签: macos sublimetext2

双引号的自动配对是一个非常奇怪的问题that I thought I'd solved,但仍然存在。问题是,对于扩展名为.php,.html的文件,自动配对双引号的默认字体样式不可解析。为了说明我的意思,请注意左侧<div>中双引号的字体样式。对于.js和.css文件,双引号自动配对具有正确的字体样式,如右侧的<div>&gt;所示。

这必须是某个地方的设置,但我不太了解Sublime Text2(Mac OSX)。想法?

enter image description here

1 个答案:

答案 0 :(得分:0)

在@JamieJag的大力帮助下,我已经解决了这个问题。 Shift +“产生的是Sublime所谓的”印刷“引用,而不是双引号,它们可以作为PHP或HTML代码的一部分进行解析。

为了解决这个问题,我在SublimeText2偏好设置&gt;键绑定 - &gt;用户中注释了所有内容。

我不清楚这些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 }
   ]
}

]*/