is there a shortcut on deleting/adding space of multiple lines in VScode?

13,183

Solution 1

You can select all and use SHIFT+TAB to unindent.

Solution 2

you can select multiple line then -> use Tab key for adding space -> use Shift + Tab keys for deleting space from beginning of line in VS code

=>for multiline at same time you can use Shift + Alt + Up/Down arrow key then edit your code or remove/add space.

=>you can edit more then one line at same time in anywhere in code press and hold Alt key then click on lines with mouse. you can edit the text at same time in different lines with different indent.

Solution 3

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

Install it, and select the area which you want to put space/tab at once and press space or tab button accordingly.

enter image description here

Share:
13,183
haneulkim
Author by

haneulkim

Data Scientist who wants to help fight climate change.

Updated on June 12, 2022

Comments

  • haneulkim
    haneulkim about 2 years

    I am looking for a way to give multiple line spacings or reduce spacing.

    for ex:

    <ul>
        <li>
        </li>
        <li>
        </li>
    </ul>
    

    becomes:

    <ul>
      <li>
      </li>
      <li>
      </li>
    </ul>