简体   繁体   English

VScode 中是否有删除/添加多行空格的快捷方式?

[英]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您可以选择多行,然后 -> 使用Tab键添加空格 -> 使用Shift + Tab键删除 VS 代码中行首的空格

=>for multiline at same time you can use Shift + Alt + Up/Down arrow key then edit your code or remove/add space. =>对于同时多行,您可以使用Shift + Alt + Up/Down箭头键,然后编辑您的代码或删除/添加空格。

=>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. =>您可以在代码中的任何地方同时编辑多于一行,按住Alt键,然后用鼠标单击行。 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 & replace 可以帮助您。 find tabs and replace them with two spaces.找到制表符并将它们替换为两个空格。 Don't forget to check "find in selection" or Alt+L.不要忘记选中“在选择中查找”或 Alt+L。

There was a feature request for that in vscode repo. 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.在 VSCode 中,通过这两个步骤添加行距的最简单方法。

  1. Add cursors to the line ends by using Shift + Alt + I short cut使用 Shift + Alt + I 快捷方式将光标添加到行尾

  2. Press Enter Key.按回车键。

    Useful when you are writing Github Readme.md or other Markdowns...在编写 Github Readme.md 或其他 Markdowns 时很有用...

    Before: (You will see 3 file names as single sentence)之前:(你会看到 3 个文件名作为一个句子)

    Beginning Git and GitHub A Comprehensive Guide to Version Control.pdf Beginning XSLT and XPath.pdf Business Intelligence Data Mining.pdf开头 Git 和 GitHub 版本控制综合指南.pdf 开头 XSLT 和 XPath.pdf 商业智能数据挖掘.pdf

    After:后:

    Beginning Git and GitHub A Comprehensive Guide to Version Control.pdf开始 Git 和 GitHub 版本控制综合指南.pdf

    Beginning XSLT and XPath.pdf开头XSLT和XPath.pdf

    Business Intelligence Data Mining.pdf商业智能数据挖掘.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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