虽然我正在为Rails项目处理Ruby文件,但我一直在与自动完成对抗 例如在写作时
email: params[:email],
password:
我按Tab键添加缩进(我知道Sublime Alignment,但有时我更喜欢自己做)并且变为password:key => "value",
我可以按很多空格,但我不喜欢它,我已经有了一个标签键,我想用它
"auto_complete": false,
"tab_completion": false,
"auto_complete_commit_on_tab": false,
"auto_complete_selector": "source - comment",
"auto_complete_size_limit": 4194304,
"auto_complete_selector": "meta.tag - punctuation.definition.tag.begin, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
// show autocomplete on tab, not automatically, commit on enter.
"keys" : ["tab"],
"command": "auto_complete",
"args" : {"default": "\t", "exact": false},
"context":
[
{ "key": "setting.tab_completion", "operator": "equal", "operand": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": ".*[^0-9][^\r ^\n ^\t ^\f]", "match_all": false },
],
"keys" : ["tab"],
"command" : "auto_complete",
"args" : {"default": "\t", "exact": false},
"context" :
[
{ "key": "setting.tab_completion", "operator": "equal", "operand": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "[][a-z]", "match_all": false },
],
// method #2
"keys" : ["tab"],
"command" : "insert",
"args" : {"characters": "\t"},
"context" :
[
{ "key": "auto_complete_visible" }
]
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
}
],
"auto_complete_with_fields": false,
答案 0 :(得分:1)
您可以设置以下键绑定,以确保 Tab 在自动完成弹出窗口未打开时始终插入制表符(并且没有选择,因此您仍然可以阻止缩进文本):< / p>
{ "keys": ["tab"], "command": "insert", "args": { "characters": "\t" },
"context":
[
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
],
},
如果您只想在Ruby on Rails上使用它,可以添加以下上下文:
{ "key": "selector", "operator": "equal", "operand": "source.ruby.rails" }