简体   繁体   中英

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

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>

您可以全选并使用SHIFT + TAB取消缩进。

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.

If you only want to change these several lines, maybe find & replace could help you. find tabs and replace them with two spaces. Don't forget to check "find in selection" or Alt+L.

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.

在此处输入图片说明

In VSCode the easiest way to add line space by this 2 steps.

  1. Add cursors to the line ends by using Shift + Alt + I short cut

  2. Press Enter Key.

    Useful when you are writing Github Readme.md or other Markdowns...

    Before: (You will see 3 file names as single sentence)

    Beginning Git and GitHub A Comprehensive Guide to Version Control.pdf Beginning XSLT and XPath.pdf Business Intelligence Data Mining.pdf

    After:

    Beginning Git and GitHub A Comprehensive Guide to Version Control.pdf

    Beginning XSLT and XPath.pdf

    Business Intelligence Data Mining.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM