Vsc替代npp

Posted by Valuex on July 7, 2023

Visual Studio Code 换替换NPP

  • 待替换位置输入”\n” ,注意左上角要允许使用正则表达式,然后点全部替换
  • “\n([A-Z])” 替换为 “$1”, 代表删除字母前的换行符,https://www.jianshu.com/p/5b4319a03d36

Tab键

在 VS code 中,使用替换功能,开启右上角的正则匹配,\t 表示 tab 键。

查找并标记

  • 选中文本后按 Ctrl + Shift + L 可以选中全部匹配的文本;
  • 接着按 Ctrl +L 则选中相应行;

    复制具有某些内容的行

    方法1

  • Press SHIFT+CTRL+L (windows) or SHIFT+CMD+L (mac) to select all instances of the phrase. This will create a cursor at the end of each instance.
  • Press CTRL+L (windows) or CMD+L (mac) to select the all the lines that have a cursor on them.
  • Copy these lines with CTRL+C (windows) or CMD-C (mac), and paste them wherever you need them.

    方法2

  • Ctrl+F –> Open find widegt.
  • Type your search string
  • CTRL + SHIFT + L to select all occurrences found (max. 999)
  • ESC (or close search dialog with top-right X)
  • CTRL + L to select whole lines
  • CTRL + C
  • Open new file
  • CTRL + V

列选择

  • 从1.23.0 起VSCode无论什么平台,都支持使用鼠标中键(滚轮键按压)进行列选择

    缩放

  • 通过ctrl+=和ctrl+-组合来进行缩放

    删除空行

  • 安装扩展: https://marketplace.visualstudio.com/items?itemName=usernamehw.remove-empty-lines