• 主页
  • 相册
  • 随笔
  • 目录
  • 存档
Total 244
Search AboutMe

  • 主页
  • 相册
  • 随笔
  • 目录
  • 存档

vscode快捷键

2020-03-07

1. 命令行

使用已经打开的窗口来打开文件

  • code -r复用

打开文件,然后滚动到文件中某个特定的行和列

  • code -g <file:line[:character]>

2. ctrl/shift/alt + ArrowKey

  • ctrl
    • Up/Down 滑块移动
    • Left/Right 光标跳词移动
  • shift
    • 光标选择
  • alt
    • Up/Down 行移动
    • Left/Right 新建光标,跳转到历史光标(可以跨文件)
      • ctrl + u 撤销光标移动
  • ctrl + shift
    • 光标跳词选择
  • ctrl + alt
    • 上下:多光标(在上/下面添加光标)
    • 左右:将编辑器移动到上/下一组
  • shift + alt
    • Up 行复制,光标不移动
    • Down 行复制,光标移动

3. 光标移动

  • Home/End

    • 行首尾
  • ctrl + shift + \

    • 花括号跳转
  • ctrl + Home/End

    • 移动到文档的第一行或者最后一行
  • ctrl + shift .

    • 面包屑导航–层级结构快速跳转
  • ctrl + G

    • 行跳转

4. 删除

  • Bs/Del

    • 删除左/右侧一个字符内容
  • ctrl + Bs/Del

    • 删除左/右侧单词内容
  • alt + Bs/Del

    • (自定义)删除左/右侧行内容
  • ctrl + shift + Bs

    • (自定义)删除整行

注意:删除整行、x侧内容是指到下一个Enter为止,而不是被缩放的、肉眼所见的‘行’

5. 代码行编辑

  • ctrl + Enter

    • 在当前行的下面新开始一行,光标移动到新行
  • ctrl +shift + Enter

    • 在当前行的上面新开始一行,光标移动到新行

6. 缩进

  • 前
    • tab
  • 后
    • shift + tab

7. 注释

  • ctrl + /
    • 行注释
  • shift + alt + a
    • 块注释

8. 鼠标操作

  • 单击

    • 光标插入
  • 双击

    • 单词选择
  • 三击

    • 整行选择
  • 四击

    • 全文选择
  • 拖动

    • 选择区域整体拖动

9. 快速修复

  • win + .
    • 调出快速修复的建议列表

10. 折叠

  • ctrl + k - ctrl +
    • 0 : 全文折叠
    • j : 全文展开
    • l : 折叠或展开当前段落

11. 搜索与替换

11.1. 搜索

  • ctrl + F / F3

    • 区别
      • 光标在搜索框还是原文
    • Enter / shift + Enter
      • 上/下一个
    • 选项
      • 大小写敏感:Alt + c
      • 全单词匹配:Alt + w
      • 正则表达式:Alt + r
    • 选定区域搜索
  • ctrl + shift + F

    • 当前编缉器内搜索(文件夹内搜索)

11.2. 替换

  • ctrl + H

12. 渲染出空格符和制表符

  • editor.renderWhitespace: all

13. 命令面板(command palette)

13.1. 符号

  • >(大于号) ,用于显示所有的命令。
  • @ ,用于显示和跳转文件中的“符号”(Symbols),在@符号后添加冒号:则可以把符号们按类别归类。
  • # 号,用于显示和跳转工作区中的“符号”(Symbols)。
  • :(冒号), 用于跳转到当前文件中的某一行
  • ? 帮助

13.2. >+单词

  • edt: edit
    • 输入edt和一个空格,命令面板就会显示所有已经打开的文件;而edt active则只会显示当前活动组中的文件
  • ext: extension
    • 输入 ext 和一个空格,就可以进行插件的管理;ext install 则可以在命令面板中搜索和安装插件
  • task
  • debug
  • term: terminal
  • view
    • 用于打开 VS Code 的各个 UI 组件。eg. zen/zoom in

14. VSCode 资源管理器

.vscode

VS Code 允许你创建几个跟当前文件夹或者跟项目有关的配置保存在这个文件夹中。这跟 IDE 的工程文件的思路是一致的,把设置放在这个文件夹中,便于团队内部进行共享。但二者区别在于,VS Code 的绝大部分功能,不需要这些配置文件也能工作,同时,这些文件都尽可能保证易于阅读和修改

  • 配置文件(settings.json)

    • 用户设置
    • 解决了个人喜好和项目规范之间的冲突
  • 调试设置(launch.json)

    • 用于说明如何调试当前文件夹下的代码
  • 任务设置(tasks.json)

    • 关于 VS Code 任务系统的配置文件

15. 多文件夹工作区

  • 将多个文件夹集合到一个工作区
  • 将文件夹添加到工作区” (add folder to workspace)
  • “将工作区另存为” (save workspace as)
  • “切换窗口(Switch Window)”
    • 切换工作区

16. 切换文件

  • Ctrl + R

    • 打开最近的文件
  • ctrl + e

    • 转到文件
  • alt + shift + r

    • reveal in explorer

17. 终端

  • “切换集成终端”(Toggle Integrated Terminal)

    • alt + t(自定)

      它的作用是:如果还没有任何集成终端存在,那么它将创建一个新的,然后显示出来;如果已经有几个集成终端了,那么就把终端面板调出来;而如果我们的光标就在集成终端里,那么这个命令会将终端面板隐藏

  • “新建集成终端”(Create New Intergrated Terminal)

    • shift + alt + t(自定)
  • 拆分终端

    • ctrl + shift + 5
    • 聚焦上/下个窗口
      • alt + up/left
      • alt + down/right
  • 翻页

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // 按行上滑
    {
    "key": "ctrl+alt+pageup",
    "command": "workbench.action.terminal.scrollUp",
    "when": "terminalFocus"
    },
    // 按页上滑
    {
    "key": "shift+pageup",
    "command": "workbench.action.terminal.scrollUpPage",
    "when": "terminalFocus"
    }
  • 文件位置

    • 右键+在终端中打开

18. 编缉器Tab

  • 打开上/下一个编辑器”(Open Previous/Next Editor)

    • Ctrl + Pagedown/Pageup
  • “打开组中的下一个编辑器”(Open Next Editor in Group)

    • ctrl + k - Ctrl + Pagedown/Pageup
  • 向x移动编缉器组

    • ctrl + k - ctrl + XArrow
  • 向左/右移动编缉器

    • ctrl + shift + PageDown/Up
  • zen

    • ctrl + k - z
  • zoom in/out

    • ctrl + =/-

19. 任务

  • label: The task’s label used in the user interface.
  • type: The task’s type. For a custom task, this can either be shell or process. If shell is specified, the command is interpreted as a shell command (for example: bash, cmd, or PowerShell). If process is specified, the command is interpreted as a process to execute.
  • command: The actual command to execute.
  • windows: Any Windows specific properties. Will be used instead of the default properties when the command is executed on the Windows operating system.
  • group: Defines to which group the task belongs. In the example, it belongs to the test group. Tasks that belong to the test group can be executed by running Run Test Task from the Command Palette.
  • presentation: Defines how the task output is handled in the user interface. In this example, the Integrated Terminal showing the output is always revealed and a new terminal is created on every task run.
  • options: Override the defaults for cwd (current working directory), env (environment variables), or shell (default shell). Options can be set per task but also globally or per platform. Environment variables configured here can only be referenced from within your task script or process and will not be resolved if they are part of your args, command, or other task attributes.
  • runOptions: Defines when and how a task is run.

“group” 属性就是分组,我们可以通过这个属性指定这个任务被包含在哪一种分组当中。关于分组,我们有三种选择:“build” 编译生成、“test”测试和 “none”

  • 自定义任务
    • 配置任务”(Configure Task)

19.1. 示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 打开浏览器
{
"version": "2.0.0",
"tasks": [
{
"label": "chrome",
"type": "process",
"command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"linux": {
"command": "/usr/bin/google-chrome"
}
}
]
}

1
2
3
4
5
6
7
8
9
10
11
{
"label": "echo",
"type": "shell",
"command": "echo",
"args": [
{
"value": "Hello World",
"quoting": "escape" // 转义
}
]
}

20. 查詢快捷鍵

  • ctrl + k, ctrl + s

21. 自动换行

  • alt + z
  • shortcut
视觉艺术笔记
Python厨书笔记-8
  1. 1. 1. 命令行
  2. 2. 2. ctrl/shift/alt + ArrowKey
  3. 3. 3. 光标移动
  4. 4. 4. 删除
  5. 5. 5. 代码行编辑
  6. 6. 6. 缩进
  7. 7. 7. 注释
  8. 8. 8. 鼠标操作
  9. 9. 9. 快速修复
  10. 10. 10. 折叠
  11. 11. 11. 搜索与替换
    1. 11.1. 11.1. 搜索
    2. 11.2. 11.2. 替换
  12. 12. 12. 渲染出空格符和制表符
  13. 13. 13. 命令面板(command palette)
    1. 13.1. 13.1. 符号
    2. 13.2. 13.2. >+单词
  14. 14. 14. VSCode 资源管理器
  15. 15. 15. 多文件夹工作区
  16. 16. 16. 切换文件
  17. 17. 17. 终端
  18. 18. 18. 编缉器Tab
  19. 19. 19. 任务
    1. 19.1. 19.1. 示例
  20. 20. 20. 查詢快捷鍵
  21. 21. 21. 自动换行
© 2024 何决云 载入天数...