 mac 版本vscode 配置及使用

一、常规配置

此配置针对 macOS 版本的 Visual Studio Code。
image-20191216211611219

1.1 配置中文

通过 ⌘⇧P 搜索打开该文件,搜索Configure Display Language,选择【安装其他语言】,选择Chinese (Simplified) Language Pack for Visual Studio Code,然后重启 vscode,就可以看到转换为中文显示了。

1.2 配置python解释器

因为平常都是使用 python 编辑器,所以这里就只涉及到 python 解释器的配置。

通过 ⌘⇧P 搜索打开该文件,配置内容如下:

1.2.1 配置setting.json文件

{
    "editor.fontSize": 16,
    "editor.fontFamily": "'Monaco'",
    "python.condaPath": "/Users/hz/anaconda3/bin/python",
    "python.pythonPath": "/Users/hz/anaconda3/bin/python",
    "window.zoomLevel": 0,
    "python.linting.flake8Enabled": false,
    "terminal.integrated.inheritEnv": false,

    "fileheader.configObj": {
        "beforeAnnotation": {
          "py":"# -*- coding: utf-8 -*-",
        },
        "prohibitAutoAdd": ["json","md"],
        "autoAdd": true,
    },
    "fileheader.customMade": {
        "Author": "huzhu",
        "Date": "Do not edit", 
        "Description": "",
    },
    "fileheader.cursorMode": {
        "description":"",
        "param":"",
        "return":""
    },
    "python.autoComplete.showAdvancedMembers": false,
    "workbench.activityBar.visible": true,
    "editor.minimap.enabled": false,
    "workbench.colorTheme": "Sublime Material Theme - Dark",

    "launch": {
		"configurations": [              
            {          
                "name": "Python: 当前文件",
                "type": "python",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal",
                "cwd": "${fileDirname}"
            }
        ],
		"compounds": []
	},
}

这里解释一下主要的配置参数:

  • python.condaPath, conda 的路径
  • python.pythonPath, python 解释器的路径
  • fileheader.configObj,fileheader.customMade,fileheader.cursorMode,这几个参数是后面提到的 python 注释插件,用于文件头部注释。
  • launch,这个是调试文件,具体的配置可以看下节。

1.2.2 配置launch.json文件

通过 ⌘⇧P 搜索打开该文件,配置内容如下:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "cwd": "${fileDirname}"
        }
    ]
}
  • cwd 这个参数很重要,表示当前的文件运行路径为当前的文件夹,而不是整个工程的目录,这样配置的好处就是在读写文件的时候会非常的方便。

1.3 配置主题和图标样式

1.3.1 配置主题样式

【Code】->【首选项】->【颜色主题】,打开颜色主题选择界面,推荐使用Monokai主题样式。

image-20191217181351796

1.3.2 配置图标样式

【Code】->【首选项】->【文件图标主题】,打开图标主题选择界面,推荐使用Monokai主题样式。

image-20191217181739912

二、好用的插件

  • koroFileHeader 文件头及函数注释

这个插件很好用,在 setting.json 中已经讲了其相关的配置,在编辑器中,按 ⌃⌘i 便可以添加文件头, ⌃⌘t 添加函数注释。

添加文件头和函数注释

  • markdownlint md 文件渲染和查看

image-20191217212129519

  • vscode-icons 图标主题
  • vscode-pdf PDF 查看器
  • python python 解释器

三、快捷方式

3.1 符号说明

  • ⌘:command
  • ⌃:control
  • ⌥:option
  • ⇧:shift
  • ↩:enter
  • ⌫:delete

3.2 常用快捷键

  • ⌘⇧P 调出搜索框(常用)
  • ⌘K 清空terminal
  • ⌘F 查找
  • ⌘⌥F 查找
  • ⌘⇧K 删除当前行
  • ⌘→ 跳转到行尾
  • ⌘← 跳转到行头
  • ⌥(→ 或 ←) 单词之间跳转
  • ⌘D 将选择添加到下一个查找匹配
  • 1
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值