How to shift a block of code left/right by one space in VSCode?
Recent versions of VSCode (e.g., Version 1.29 at the time of posting this answer) allow you to change the Tab/Space size to 1
(or any number between 1
and 8
). You may change the Tab/Space size from the bottom-right corner as shown in the below image:
Click on Spaces:4
. Then, select Indent Using Spaces or Indent Using Tabs and choose the size 1.
Hope it helps.
UPDATE
While these methods work, newer versions of VS Code uses the Ctrl+] shortcut to indent a block of code once, and Ctrl+[ to remove indentation.
This method detects the indentation in a file and indents accordingly.You can change the size of indentation by clicking on the Select Indentation setting in the bottom right of VS Code (looks something like "Spaces: 2"), selecting "Indent using Spaces" from the drop-down menu and then selecting by how many spaces you would like to indent.
There was a feature request for that in vscode repo. But it was marked as extension-candidate
and closed. So, here is the extension: Indent One space
Unlike the answer below that tells you to use Ctrl+[ this extension indents code by ONE whtespace ð¤¦♂️.
No need to use any tool for that
- Set Tab Spaces to 1.
- Select whole block of code and then press Shift + Tab
Shift + Tab = Shift text right to left