0. 记录下最新状态的【首选项-用户配置】内容:快捷键为:F1;
{
"window.zoomLevel": 3,
"editor.fontSize": 16,
"workbench.editor.enablePreview": false,
"editor.unicodeHighlight.allowedLocales": {
"zh-hant": true
},
"security.workspace.trust.untrustedFiles": "open",
"python.defaultInterpreterPath": "/Users/***/miniconda3/bin/python",
"editor.fontLigatures": false,
"workbench.colorCustomizations": {
"editor.lineHighlightBackground":"#86e9e93d",
"editor.lineHighlightBorder": "#ffffff30",
"editor.selectionBackground": "#156387"
},
"redhat.telemetry.enabled": true,
"workbench.colorTheme": "Default High Contrast",
"workbench.startupEditor": "none",
"terminal.integrated.inheritEnv": false,
"editor.renderWhitespace": "all"
}
1. 修改代码背景颜色
1)Shift + Command + P,搜索框输入:settings.json
2)输入配置
{
"workbench.colorCustomizations": {
"editor.lineHighlightBackground": "#86e9e93d", # 修改鼠标所在行背景色
"editor.lineHighlightBorder": "#ffffff30", # 修改选中区域边框颜色
"editor.selectionBackground": "#15709a" # 修改选中区域背景色
}
}
2. 配置python文件模板
1)如下图
2)选择python.json文件
3)配置
{
"HEADER": {
"prefix": "header",
"body": [
"#!/usr/bin/env python",
"# -*- encoding: utf-8 -*-",
"'''",
"@Time : $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
"@Author : ***@***.com.cn",
"@Desc : ",
"'''",
"",
"$0"
],
}
}
4)新建.py文件,在文件内输入header,选中如下图提示项,回车即可
3. 修改快捷键
1)进入快捷键配置
2)在输入框输入关键词
3)双击你希望修改的快捷键,然后输入你想要的快捷键组合,enter保存
4)也可以进行比如删除快捷键等操作
4. VSCODE一直检测代码存在缩进错误:TabError: inconsistent use of tabs and spaces in indentation
解决办法:
1)点击进入设置
2)输入tabSize检索缩进,默认4个空格,保持不变;
3)输入renderWhitespace,设置为all;
4)替换所有的Tab为4Space:按F1,输入“缩进”,结果中选择“将缩进转换为空格”。
5)完成;