Monday, 26 May 2014

Add Reindent keyboard shortcut to Sublime-Text 3

I like my code to be always properly formatted, which makes it easier to read and understand. I use Sublime-text for coding and it has Reindent feature which can be found at Edit>>Line>>Reindent ,but everybody wants a keyboard shortcut.

Here is how you can add this shortcut in sublime

Go to Preferences>>Key Bindings - User>>

Now add below key value pair to existing json array (mostly it would be empty previously)

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

My file contents looks like this

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

Instead of ctrl+shift+r you can have any other shortcut you like eg. f12, ctrl+r ...

And remember, To make this shortcut work , you need to have syntax highlighter plugin already installed for the programming language you are using.

Thats it guys. Enjoy the beautiful code.

No comments:

Post a Comment