如何使用【VS Code】提高攻速?

VS Code(Visual Studio Code) 攻略:


入门必备

  • f1或shift + alt+ p 显示命令面板,输入language,更改语言类型,输入 color 更改颜色主题,输入search进行网页查询,可输入vscode任意命令。
    • 删除“>" 进入 ctrl + p 模式,进行最近文件搜索,继续按P向下切换
    • 输入 “>” 重新进入 shift+alt+p 模式
    • 直接输入文件名可跳转到文件
    • ? 列出当前可执行的动作
  • 修改默认快捷键 ctrl+k ctrl+s 双击按键绑定,可自定义快捷键
  • 开启自动保存 : 文件 > 自动保存,防止意外
  • 侧边栏快捷操作,ctrl + shift + E/F/G/D/X 依次打开,ctrl + B 关闭侧边栏
  • 常用快捷键

常用插件

  • open in browser 打开浏览器 alt+b
  • Auto Rename Tag 修改HTML标签时,自动修改匹配的标签
  • CodeBing 显示搜索栏输入后弹出浏览器 shift+alt+f
  • beauty 美化代码
  • color info 显示颜色信息
  • editorconfig来实现多种编辑器的代码风格统一
  • HTML CSS support css自动补齐
  • background 自定义背景图

代码格式化

  • 编译器默认:shift + alt + f(windows)
  • 项目自定义
    1. 在项目文件中新建 .editorconfig 文件,需下载editorconfig插件
    2. 为特定类型文件指定缩进大小、缩进类型(空格,或tab),是否自动插入末行等
    root = true  必须有root
    [*]charset = utf-8
    indent_style = tab
    indent_size = 4
    insert_final_newline = true
    trim_trailing_whitespace = true

用户代码片段

  • 文件 > p > s > s 或者 ctrl + shift + p 输入用户代码片段,选择后新建代码片段可编辑 json 文件进行自定义各种语言
    以html为例,编辑json,新建html 文件 输入myhtml tab
	"Print to console": {
        "prefix": "myhtml",  前缀
        "body": [
            "<!DOCTYPE html>",
            "<html lang='en'>",
            "<head>",
            "<title> my document </title>",
            "</head>",
            "<body>",
            "<header> header </header>",
            "<div class='main-container'>",
            "<aside></aside>",
            "<div id=container></div>",
            "<section></section>",
            "</div>",
            "<footer>footer</footer>",
            "</body>",
            "</html>"
        ],
        "description": "Log output to console"
	}

markdown可视化

ctrl+shift+v 进行预览
ctrl+ shift + p 输入markdown,选择打开侧边预览,


配合github源代码管理

要在 VSCode 里面操作 Git,前提是你已经配置好了 Git,如果你没有配置过,那么就在 Git Bash 里输入以下命令:

git config --global user.name 你的英文名
git config --global user.email 你的邮箱
git config --global push.default matching
git config --global core.quotepath false
git config --global core.editor “vim”

ctrl + shift + x 可查看所有功能,vscode具有git 集成,内置git命令,可简化操作。
入门使用:
新建库,git clone 到新文件夹,新建文件并编辑, ctrl + shift + g ,输入框输入此次更改,选择 “√”,点击右边 " … " ,选择推送。


持续更新中…

猜你喜欢

转载自blog.csdn.net/weixin_39531638/article/details/82940095