When I write HTML in Sublime Text 3, I like having autocompletion of attributes and element names and so on, but Sublime Text is always over-predicting things and turning my text content into elements (inappropriately), when the vast majority of the document body I am writing is text, not elements. What gets really annoying is if I press Enter at the end of a line where it believes the word I am typing is a typo of a different element, I get some really frustrating behavior:
The workaround I see is to press EscEnter at the end of every line but that isn't particularly ergonomic (and I have severe RSI so I'd rather have things be ergonomic).
Here are the relevant portions of my Preferences.sublime-settings:
{
"auto_complete": false,
"auto_complete_selector": "source - (comment, string.quoted)",
"tab_completion": false,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": true
}
I have looked at the Sublime Text documentation regarding completions and snippets but it isn't obvious to me how to suppress completions entirely during a text context. I don't currently have any HTML-mode-specific options configured.
答案 0 :(得分:2)
Sublime的HTML自动填充功能是在Python脚本中实现的。
可以对其进行编辑,这样只有在键入<
和字母时才会提供HTML标记 - 而不是在HTML中输入“普通”文本内容时提供HTML标记。
要做到这一点:
PRV: O
并选择PackageResourceViewer: Open Resource
HTML
html_completions.py
# if the opening < is not here insert that
行(https://github.com/sublimehq/Packages/blob/77867ed8000601962fec21a012f42b789c42195b/HTML/html_completions.py#L243)completion_list = [(pair[0], '<' + pair[1]) for pair in completion_list]
更改为completion_list = []
请注意,这会创建一个覆盖ST附带版本的文件,因此在发布新版本的ST3时,仍会使用您的版本。如果此文件被更新,最好删除您的版本以确保您拥有最新的更改,然后重新应用上述步骤(如果需要 - 可能会在将来的更新中“修复” auto_complete
设置为false
时不建议任何内容。要做到这一点:
Tools
- &gt; Browse Packages
HTML
html_completions.py