Skip to content

搭建完美vscode环境

操作篇

文本操作

opt 说明
ctrl + 左右 关闭快速移动到词头尾
ctrl + shift + 左右 关闭快速选择一个词
ctrl + shift + L 快速选择鼠标所在的词, 包含文档中所有相同的词
  • 段 | opt | 说明 | |---|---| | ctrl + F2 | 选中了一段之后执行此快捷键,会选出所有相同的元素 |

  • opt 说明
    ctrl + L 快速选择当前行, 一般会和其他快捷键冲突,建议修改为 ctrl + alt + L
    alt + shift + 上下 复制一行到上一行或下一行

配置篇

  • 常用配置
{
    // "terminal.integrated.profiles.windows": {
    //     // ...
    //     "Git Bash": {
    //         "source": "Git Bash",
    //         "path": "E:\\apps\\Git\\bin\\bash.exe"
    //     }
    // },
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    // 配置此项,保证windows 环境和 linux 环境 换行符一致
    "files.eol": "\n",
    // 保证编辑文本时,左侧explore 不要跟着动, 这样配合 快捷键绑定(2) 中操作,左侧就不会跳来跳去了,又非常好找代码
    "explorer.autoReveal": false
}
  • 快捷键绑定
id option 说明 binding key
1 Switch Window 切换窗口 ctrl + shift + i
2 Reveal Active Key 显示当前文件所在目录 ctrl + alt + i

其他

代理配置

// 不要写成 http://127.0.0.1:7890, 否则有些走代理会出现错误
"terminal.integrated.env.linux": {
    "http_proxy": "127.0.0.1:7890",
    "https_proxy": "127.0.0.1:7890"
},

markdown 图片复制

vscode 1.79 版支持在markdown 中直接粘贴图片,不用再担心本机、wsl或remote环境的markdown图片配置问题了^[https://juejin.cn/post/7244809769794289721]

我的配置参考:

"markdown.copyFiles.destination": {
    // 将复制的图片放入根目录下的imgs文件夹中
    "**/*": "${documentWorkspaceFolder}/imgs/"
}

插件篇

根据路径跳转到文件

https://marketplace.visualstudio.com/items?itemName=rexebin.f12-open-file

  • 主要用于在注释中跳转到对应文件,相当好用

Comments