Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reindent shortcut in sublime text [duplicate]

Possible Duplicate:
Indenting code in Sublime text 2?

I'm trying to learn keyboard shortcuts in Sublime. What is the keyboard shortcut in Sublime Text 2 for reindent? According to some pages it should be TAB but that only indents, not reindents.

like image 520
Yaron Naveh Avatar asked Aug 29 '12 16:08

Yaron Naveh


People also ask

What does Ctrl B do in sublime?

Bookmark this question. Show activity on this post. In Sublime Text 3,when we press Ctrl+Shift+B, we are given the option to either do "Build and Run" or "only Build", whereas Ctrl+B executes the previously chosen operation among the two.

What is the shortcut key for Sublime Text?

The shortcut key for this purpose is Ctrl+Shift+P for Windows and Cmd+Shift+P for Mac.

How do you copy in Sublime Text 3?

To quickly duplicate a line of code, place the cursor anywhere in the line and hit Cmd–Shift–D(Mac) or Ctrl–Shift–D (Windows).


2 Answers

You can find it in Edit>>Line>>Reindent, but it does not have a shortcut by default. You can add a shortcut by going to the menu Preferences - Keybindings-User, then add there (the config file takes as a JSON format):

[
    { "keys": ["f12"], "command": "reindent"} 
]

(example of using the F12 key for that functionality)

like image 88
Kummo Avatar answered Oct 20 '22 05:10

Kummo


I use cmd-[ and cmd-] for indenting but I am not sure exactly what you mean by "reindent"...

Ahh, OK I get your question now, you can use the command to re-calculate and apply correct indentation to a file. For example, if you open a file that has had been programmatically altered and had whitespace stripped or tabs removed you would use the reindent command to restore correct formatting.

like image 34
DyeA Avatar answered Oct 20 '22 04:10

DyeA