1

I want to add a keybinding for Reindent(Edit>Line>Reindent).

I have tried adding

"keys": ["ctrl+shift+i"], "command": "reindent"

But this does nothing even after restarting sublime

Other answers seems to be outdated.

Full Settings-User file:

// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
    "update_check":false,
    "font_size":11,
    {"keys": ["ctrl+shift+i"], "command": "reindent"},
}
  • Forgot curly brackets around the statement? {"keys": ["ctrl+shift+i"], "command": "reindent"}, – Art Gertner Oct 15 '14 at 13:18
  • @smc No, that gives me Error trying to parse settings: Expected value in Packages/User/Preferences.sublime-settings:6:2 – Lightvvind Oct 15 '14 at 13:28
  • Can you post full example? more than just one line. Also, which file are you editing? – Art Gertner Oct 15 '14 at 13:30
  • @smc added the entire file in my post – Lightvvind Oct 15 '14 at 13:34
0

I believe you are adding the config to the wrong file. It has to go into Key Bindings - User , not in the Settings - User.

Also you don't need the comma at the end of the last line in the list.

According to the information you have provided, here is what I recommend:

Edit the contents of your Settings - User to the following:

// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
    "update_check":false,
    "font_size":11
}

Edit the contents of your Key Bindings - User to the following:

[
    {"keys": ["ctrl+shift+i"], "command": "reindent"}
]

Note, if you want to always reindent the entire contents of the open file regardless the selection you can edit your Key Bindings - User to the following:

[
    {"keys": ["ctrl+shift+i"], "command": "reindent", "args": {"single_line": false}}
]
| improve this answer | |
  • Worked great, and now I feel like an idiot for not seeing the key-bindings file haha. Thanks mate! – Lightvvind Oct 15 '14 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.