【发布时间】:2017-06-03 10:55:32
【问题描述】:
在为 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,
【问题讨论】:
-
你知道专用缩进键和非缩进键吗?在 Linux 和 Windows 上,键
ctrl+]和ctrl+[将分别执行缩进和取消缩进。在 OSX 上使用super+]和super+[。
标签: ruby-on-rails ruby autocomplete sublimetext3 indentation