对 HTML 标记补全感到烦恼?
很有可能你就是这样到达这里的。在 SublimeText 中有一个众所周知的现象,如果你在“标签”或“表单”之类的词之后按 Tab,它会假定你是尝试插入一个 tag 并为您完成它。实际上,如果您处于类似 HTML 的上下文中,则永远不能在这样的单词之后插入制表符。
我刚刚想出了禁用它的方法。因为不,tab_completion:false 不会摆脱它。也不会打开资源文件和编辑 python 脚本以及您可以在网上找到的任何其他内容 - 这似乎是一场徒劳的战斗直到您意识到整个事情几乎都被硬编码到 Tab 键的功能中;所以只需打开你的键绑定,在左侧,默认情况下,寻找这个神奇的序列:
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false},
"context":
[
{ "key": "setting.tab_completion", "operator": "equal", "operand": true },
{ "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true },
]
},
{ "keys": ["tab"], "command": "replace_completion_with_next_completion", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["tab"], "command": "reindent", "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "text", "operator": "regex_contains", "operand": "\n" }
]
},
{ "keys": ["tab"], "command": "next_field", "context":
[
{ "key": "has_next_field", "operator": "equal", "operand": true }
]
},
{ "keys": ["tab"], "command": "commit_completion", "context":
[
{ "key": "auto_complete_visible" },
{ "key": "setting.auto_complete_commit_on_tab" }
]
},
现在您所要做的就是将其复制到右侧(键盘映射 - 用户),然后删除前 2 个声明。那些说“insert_best_completion”的人。这样一来,您的 Tab 键仍将执行它通常应该执行的所有操作,缩进/取消缩进等等,除了那个让您疯狂很久的讨厌的自动完成功能。
哦,不客气。
不完全是。我的荣幸。
无法告诉你我现在感到多么轻松。