i'm trying to indent my code in visual studio code. I searched and i found that ctrl + F + K should be work, but it doesn't. I tried cmd + k + f too, but it still not working. I hope you can help me!
-
Close, but it is not exactly cmd + k + f (not all 3 keys at the same time), see my answer below for the exact combination. – auspicious99 Jun 04 '20 at 10:11
-
In VS4Mac 2019, there are three shortcuts configurations: VS for Mac (native), VS for Windows and VS Code. It prompts to select one of three scheme right after the installation. That is why the answers below are different and confusing; as each one is covering different scheme, without specifying which one. VS for Mac's native shortcut to format document is mentioned in Tim Cuculic's answer: `Control + i`, but if you had VS for Windows scheme selected, it won't work (then I think the shortcut is `Control + Shift + F`). – vulcan raven Nov 25 '20 at 23:11
8 Answers
Updated December 21, 2017: as pointed out by Fabio, on mac it should be: ⌘
+ ]
On Windows: indent control is ctrl
+ ]
A good way to find commands is by navigating to: Code -> Preferences -> Keyboard Shortcuts
Also, the Visual Studio Code team provided those handy shortcut pdfs:
Another helpful command to achieve this might be: shift + option + f which is auto format.
![](../../users/profiles/1467478.webp)
- 957
- 13
- 21
-
2
-
7This only indents the code, it doesn't actually format it. option+shift+F doesn't do it either – Pablo Apr 06 '18 at 19:32
-
6
The shortcut to format code on Visual Studio for Mac Community Edition is Ctrl + i
![](../../users/profiles/967841.webp)
- 438
- 5
- 5
(edited on 4th June 2020: the answer below still remains the same, in version 1.45.0, 7 May 2020)
For visual studio code version 1.36.1 (2019)
To auto-format the selection, use ⌘K ⌘F (the trick is that this is to be done in sequence, ⌘K first, followed by ⌘F).
To just indent (shift right) without auto-formatting, i.e., blindly indent, use ⌘]
As indicated in Visual Studio Code's Keyboard Shortcuts (⌘K ⌘S, or from the menu as shown below)
![](../../users/profiles/1578867.webp)
- 2,413
- 1
- 26
- 40