c语言样式主题 清爽风格 代码色彩 keil风格 适合单片机开发GD32 STM32等 cursor或者vscode 的settings.json文件
如上图,是不是和keil mdk很相近。
代码色彩,简单,配合 // 设置工作台主题为 Visual Studio 2017 Light - C++
主题使用, 代码紧凑,不干扰视觉,清爽,。 让你专注于代码。
下面 是 cursor或者vscode 的settings.json的配置文件
{
{
// 启用命令中心
"window.commandCenter": true,
// 设置 CMake 选项在状态栏中的显示模式为图标
"cmake.options.statusBarVisibility": "icon",
// CMake 高级选项配置:build、launch、debug 均继承默认的“visible”设置
"cmake.options.advanced": {
"build": {
"statusBarVisibility": "inherit", // 继承上级设置
"inheritDefault": "visible" // 默认显示
},
"launch": {
"statusBarVisibility": "inherit",
"inheritDefault": "visible"
},
"debug": {
"statusBarVisibility": "inherit",
"inheritDefault": "visible"
}
},
// 设置工作台主题为 Visual Studio 2017 Light - C++
"workbench.colorTheme": "GitHub Light Default",
// 编辑器字体大小设置为 12
"editor.fontSize": 11,
"editor.fontFamily": "Consolas , 'Courier New', monospace", //Consolas
// 设置文件编码为 gb2312,并启用自动猜测编码
"files.encoding": "gb2312",
"files.autoGuessEncoding": true,
// 自定义编辑器语法高亮颜色
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
// "support.type.stdint", // uint32_t/uint8_t 等
"entity.name.type",
"storage.type", // 基础类型 (int/float 等)
// "meta.type",
// "meta.function.definition storage.type"
],
"settings": {
"foreground": "#aa1f1f", // 蓝色
"fontStyle": "bold" // 可选加粗
}
},
{
"scope": "comment",
"settings": {
"foreground": "#a6afa9"
}
},
{
"scope": "comment.line.double-slash",
"settings": {
"foreground": "#a6afa9"
}
},
{
"scope": "comment.block",
"settings": {
"foreground": "#a6afa9"
}
},
{
"scope": "comment.block.documentation",
"settings": {
"foreground": "#a6afa9"
}
},
{
"scope": "punctuation.definition.comment",
"settings": {
"foreground": "#a6afa9"
}
},
{
"scope": "constant.numeric",
"settings": {
"foreground": "#000000"
}
},
{
"scope": "variable.parameter",
"settings": {
"foreground": "#000000"
}
},
{
"scope": ["variable.other.local", "variable.other"], // 根据需要调整 scope
"settings": {
"foreground": "#000000" // 设置您想要的背景色,例如黄色
}
},
{
"scope": [
"keyword.control",
"keyword.control.conditional",
"keyword.control.loop"
],
"settings": {
"foreground": "#0d28be"
}
},
{
"scope": "meta.preprocessor.define",
"settings": {
"foreground": "#000000"
}
},
{
"scope": "variable.other.local.preprocessor",
"settings": {
"foreground": "#008000"
}
},
{
"scope": [
"keyword.other",
"keyword.other.type",
"keyword.other.data",
"keyword.other.primitive"
],
"settings": {
"foreground": "#1a1dbe"
}
},
{
"scope": "constant.other",
"settings": {
"foreground": "#3b3b3b"
}
},
{
"scope": "variable.other.enummember",
"settings": {
"foreground": "#000000"
}
},
{
"scope": [
"entity.name.function.preprocessor",
"entity.name.macro"
],
"settings": {
"fontStyle": "",
"foreground": "#00632c"
}
},
{
"scope": "meta.function.definition.parameters.c",
"settings": {
"foreground": "#000000",
"fontStyle": "bold"
}
},
{
"scope": [
"entity.name.function",
"entity.name.function.declaration"
],
"settings": {
"foreground": "#000000" // 将此处的颜色值替换为您想要的颜色
}
},
{
"scope": "keyword.operator",
"settings": {
"foreground": "#323bad"
}
}
]
},
// 自定义工作台颜色配置
"workbench.colorCustomizations": {
"editorBracketMatch.background": "#FF0000",
"editorBracketMatch.border": "#FF0000",
"editorBracketMatch.fg": "#FF0000",
"editor.wordHighlightBackground": "#0000FF33",
"editor.wordHighlightStrongBackground": "#0000FF33",
"editor.activeIndentGuide.background": "#9e2f2f",
"editorIndentGuide.background1": "#fafafa"
},
// 禁用括号配对着色
"editor.bracketPairColorization.enabled": false,
// 禁用字体连字
"editor.fontLigatures": false,
// 建议列表中不自动选择项目
"editor.suggest.selectionMode": "never",
// 禁用粘性滚动
"editor.stickyScroll.enabled": false,
// 为 C/C++ 设置 clang-format 的备用样式为 Google
"C_Cpp.clang_format_style": "file",
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: LLVM, ColumnLimit: 300, AllowShortCommentsOnASingleLine: true }",
// 启用格式化保存
"editor.formatOnSave": false,
// 指定 clang-format 配置文件路径
"C_Cpp.clang_format_path": "E:\\EIDE\\v4d5\\Eide\\gd32e230-quickstart\\.clang-format",
// 设置默认格式化程序为 xaver.clang-format
"editor.defaultFormatter": "xaver.clang-format",
// 禁用自动换行
"editor.wordWrap": "off",
// 设置最大行长度为 240,并在超过时提供提示
"editor.rulers": [
240
],
// 工作台颜色自定义设置
"workbench.colorCustomizations": {
"editor.background": "#dbdfdb", // 设置编辑器背景为白色 #363b40
// "editorBracketMatch.background": "#FF0000", // 匹配括号背景色
// "editorBracketMatch.border": "#FF0000", // 匹配括号边框色
// "editorBracketMatch.fg": "#FF0000", // 匹配括号前景色
"editor.wordHighlightBackground": "#709dd15b", // 单词高亮背景
// "editor.wordHighlightStrongBackground": "#2525d6a9", // 强调单词高亮背景
// "editor.activeIndentGuide.background": "#9e2f2f", // 当前活动缩进指南颜色
"editorIndentGuide.background1": "#e7e7eb", // 缩进指南颜色
"editor.selectionBackground": "#709dd15b",
"editor.selectionHighlightBackground": "#4b49495b",
// 控制台背景设置
"terminal.background": "#ebf0ec", // 集成终端背景色
// "debugConsole.background": "#363b40", // 调试控制台背景色
// 工作区各区域背景设置
"sideBar.background": "#ebf0ec", // 侧边栏背景色 #363b40
"activityBar.background": "#ebf0ec", // 活动栏背景色
"statusBar.background": "#ebf0ec", // 状态栏背景色
"editor.lineHighlightBackground": "#e9e9e9f3",
// 行号颜色设置(背景色默认与编辑器一致)
// "editorLineNumber.foreground": "#6b6b6b", // 行号文字颜色
// "editorGutter.background": "#363b40",
// "editorLineNumber.activeForeground": "#6b6b6b" // 当前行行号文字颜色
},
// 启用鼠标滚轮缩放功能
"editor.mouseWheelZoom": true,
"editor.lineHeight": 1.5,
"workbench.editor.doubleClickTabToToggleEditorGroupSizes": "maximize",
"workbench.editor.tabSizingFixedMaxWidth": 200,
"cmake.showOptionsMovedNotification": false,
"C_Cpp.default.compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\Hostx64\\x86",
"EIDE.Cppcheck.ExecutablePath": "${userRoot}/.eide/tools/cppcheck/cppcheck.exe",
"EIDE.OpenOCD.ExePath": "${userRoot}/.eide/tools/openocd_7a1adfbec_mingw32/bin/openocd.exe",
"EIDE.ARM.Option.AxfToElf": true,
"EIDE.ARM.ARMCC5.InstallDirectory": "C:\\Keil_v5\\ARM\\ARMCC",
"EIDE.ARM.ARMCC6.InstallDirectory": "C:\\Keil_v5\\ARM\\ARMCLANG",
"redhat.telemetry.enabled": true,
"git.openRepositoryInParentFolders": "never",
"chat.editor.fontSize": 12,
"markdown.preview.fontSize": 11,
"debug.console.fontSize": 12,
"terminal.integrated.fontSize": 12,
"scm.inputFontSize": 12,
"errorLens.statusBarColorsEnabled": true,
"errorLens.messageEnabled": true,
"errorLens.fontSize": "11",
"[c]": {
"editor.wordBasedSuggestions": "off",
"editor.semanticHighlighting.enabled": true,
"editor.stickyScroll.defaultModel": "foldingProviderModel",
"editor.suggest.insertMode": "replace",
"editor.defaultFormatter": "xaver.clang-format"
},
"cortex-debug.liveWatchRefreshRate": 1000,
"editor.guides.highlightActiveIndentation": false,
"ShortcutMenuBar.navigateForward": false,
"ShortcutMenuBar.navigateBack": false,
"ShortcutMenuBar.openFilesList": false,
"ShortcutMenuBar.toggleTerminal": false,
"ShortcutMenuBar.undo": true,
"ShortcutMenuBar.redo": true,
"ShortcutMenuBar.beautify": false,
"errorLens.borderRadius": "0.4em",
"errorLens.gutterIconSet": "circle",
"errorLens.alignMessage": {
"start": 0,
"end": 0,
"minimumMargin": 0,
"padding": [
0,
0
],
"useFixedPosition": true
},
"errorLens.enabled": false,
"workbench.sideBar.location": "right"
}
代码格式化工具的配置。 需要放在你的对应工作 目录下,比如我的。
用了这个代码格式化工具后,你的代码就会很整齐。而且,不会随意换行。折行等情况。
E:\EIDE\v4d5\Eide\gd32e230-quickstart\
.clang-format
---
BasedOnStyle: Microsoft
Language: Cpp
###################################
# indent conf
###################################
UseTab: Never
IndentWidth: 4
TabWidth: 4
ColumnLimit: 300
AccessModifierOffset: -4
NamespaceIndentation: All
FixNamespaceComments: false
BreakBeforeBraces: Linux
###################################
# other styles
###################################
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
IndentCaseLabels: true
SortIncludes: false
AlignConsecutiveMacros: AcrossEmptyLines
AlignConsecutiveAssignments: Consecutive
###################################
# comment related options
###################################
ReflowComments: false