Assign "Tab" (key) to "Tab" (indentation) in Sublime Text 3

Viewed 352

While I'm handling Ruby files for Rails projects, I keep fighting the auto-complete
for example while writing

email:      params[:email],
password:

I press tab to add an indentation (I know Sublime Alignment, but sometimes I prefer to do it on my own) and it becomes password:key => "value",
I could press many spaces instead, but I don't like it and I already have a key for the tabs, I would like to use it

stuff I tried from old answers without success:

preferences file:

    "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",

key bindings:

          // 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,
2 Answers

in the key map, this is managed by the rule:

{ "keys": ["tab"], "command": "next_field", "context":
        [{ "key": "has_next_field", "operator": "equal", "operand": true }]
    },

Override this rule by

{ "keys": ["tab"], "command": "next_field", "context":[]}
Related