我的 VS code 配置总结
一、我的settings.json
{
"extensions.ignoreRecommendations": true,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"files.hotExit": "off",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"git.ignoreMissingGitWarning": true,
"workbench.startupEditor": "newUntitledFile",
"code-runner.runInTerminal": true,
"explorer.confirmDelete": false,
"editor.renderWhitespace": "all",
"git.autofetch": true,
"editor.fontFamily": "JetBrains Mono",
"editor.fontLigatures": true,
}
二、VScode常用插件
* 1. C/C++
* 2. Python
* 3. Code Runner
* 4. indent-rainbow
* 5. Project Manager
# 6. Cmake
# 7. Cmake Tools
# 8. koroFileHeader
# 9. C++ Intellisense
# 10. Bracket Pair Colorizer2
# 11. Visual Studio ItelliCode
三、其他设置
-
使用vscode配置Python环境时的几个注意事项
-
以下三个路径需要添加环境变量
.\Anaconda .\Anaconda\Scripts .\Anaconda\Library\bin
-
输出需要位于终端中
-
py文件路径不能包含中文
-
若终端执行"conda activate base"出错,则在powershell中运行
conda init powershell
-
若后续powershell中报错“因为在此系统上禁止运行脚本”,则在powershell中执行
set-executionpolicy remotesigned
-
-
我的自定义代码块
-
python
"Encoding_UTF8": { "prefix": "utf8", "body": [ "# -*- coding:utf-8 -*-", "$1" ], "description": "Encode with UTF-8" }
-
C
"re_print": { "prefix": "print", "body": [ "int fputc(int ch, FILE *f)", "{", " uint8_t temp[1] = {ch};", " HAL_UART_Transmit(&huart$1, temp, 1, 2);", " return ch;", "}" ], "description": "串口重定向" }
-
-
解决终端界面输出中文乱码问题
-
终端调用的是powershell,而powershell默认代码页为936(GB 2312)
-
临时修改代码页为UTF-8:chcp 65001
-
永久修改代码页:在控制面板>>区域>>系统区域,将使用UTF-8打勾即可
-
-
koroFileHeader配置选项
{ // 文件头部注释 "fileheader.customMade": { "Author": "lavida", "version": "", "Date": "Do not edit", "LastEditTime": "Do not Edit", "Description": "" }, //函数注释 "fileheader.cursorMode": { "name": "", "func": "", "param": "", "return": "" }, }