Reputation: 1583
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!
Upvotes: 67
Views: 205789
Reputation: 373
This worked for me on Mac OS. (alt + shift + F)
Upvotes: 5
Reputation: 2810
By below steps you can update your preference (2024)
Upvotes: 0
Reputation: 37342
For me, the Input Source was English India.
So, Option + Shift + F resulted in showing ̰
After changing the Input Source to English I was able to format the code using the above shortcut.
Upvotes: 5
Reputation: 17
You can always redefine the shortcut via the preferences > Keyboard Shortcuts: Mine was set to ^|, which did not work. So I changed it to shift + option + f (since this shortcut only printed Ï)
Hope this helps ;).
Upvotes: 0
Reputation: 4311
(edited on 4th Jan 2023: the answer below still remains the same, in version 1.74.2, Nov 2022)
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)
Upvotes: 18
Reputation: 487
cmd + A + cmd + K + cmd + F
this worked for me.
All I do is to hold "cmd" and then press A, K, and F one by one.
Upvotes: 6
Reputation: 514
Fix Formatting in Visual Studio for MAC 2019: Control + I Source here
Upvotes: 0
Reputation: 54
On Visual Studio for Mac Version 8.7
Select the code and go Edit -> Format -> Format Document
Upvotes: 3
Reputation: 563
The shortcut to format code on Visual Studio for Mac Community Edition is Ctrl + i
Upvotes: 37
Reputation: 1084
The shortcut to align code in MAC is : Option/ALT + Shift + F.
Upvotes: 22
Reputation: 111
Visual Studio for Mac Community Edition v 7.5.4 code format is: ^ I
Upvotes: 9
Reputation: 1095
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.
Upvotes: 60