VueMastery

插件名称 | 插件描述 |
---|---|
🎨Monokai Pro | 编辑器颜色主题 |
📁Material Icon Theme | 文件、目录图标主题 |
/** settings.json */
{
"workbench.tree.indent": 16, // 目录树视图缩进宽度
"workbench.colorTheme": "Monokai Pro (Filter Spectrum)", // 主题颜色
"workbench.iconTheme": "material-icon-theme", // 文件图标主题(特别的文件会显示特殊图标)
"workbench.editor.enablePreview": true, // 禁用预览模式
"workbench.list.openMode": "doubleClick" // 控制如何打开文件项,双击或单击
}
{
"security.workspace.trust.untrustedFiles": "open", // 打开文件时不要提示 "是否安全信任"
"security.promptForLocalFileProtocolHandling": false // 在使用本地协议打开文件时不要弹出提示
}
{
"explorer.confirmDelete": false, // 删除文件时, 不需要再确认是否放入回收站
"explorer.confirmDragAndDrop": false, // 拖拽文件到其他目录中时不再需要确认
"explorer.confirmPasteNative": true, // 在复制粘贴文件时, 不需要确认是否覆盖
"explorer.compactFolders": false, // 关闭单文件目录与子文件名称压缩在一行上显示
"explorer.autoReveal": false // 控制资源管理器是否应在打开文件时自动显示并选择文件
}
插件名称 | 插件描述 |
---|---|
📝Prettier - Code formatter | 代码格式化 |
{
"editor.fontSize": 16, // 编辑区字体大小
"editor.tabSize": 4, // 一个 tab 等于的空格数
"editor.wordWrap": "on", // 控制超过视区宽度自动折行、换行
"editor.formatOnSave": true, // 在保存时自动格式化
"editor.mouseWheelZoom": true, // 鼠标滚轮缩放编辑区字体大小
"editor.minimap.enabled": false, // 是否显示缩略图
"editor.minimap.maxColumn": 120, // 控制缩略图的宽度
"editor.lineNumbers": "on", // 编辑区行号显示
"editor.suggest.showIcons": true, // 控制是否在内联建议中显示或隐藏图标。
"editor.suggest.showInlineDetails": true, // 是否显示具体的提示内容
"editor.suggest.showMethods": true, // 显示方法建议
"editor.accessibilitySupport": "off", // 启用无障碍支持
"diffEditor.wordWrap": "on", // 文本将在视区宽度处换行
"editor.fontFamily": "Cascadia Code Extralight, 'Cascadia Mono', Consolas", // 编辑区字体
"editor.fontLigatures": true, // 启用字体连字(如果字体支持连字会显示连字)
"editor.stickyScroll.enabled": false, // 滚动过程中, 显示当前行所属的作用域(默认 true)
"files.autoSave": "off", // 在窗口改变时(从vscode到别的窗口)自动保存文件,可选值: onFocusChange, onWindowChange, off, afterDelay, 为了避免有时候切换窗口时还并不想保存却自动保存了,所以关闭此功能
"editor.insertSpaces": true, // 插入空格
"editor.detectIndentation": true, // 启用自动检测缩进
"editor.indentSize": 2, // 一个缩进的宽度
"editor.tabCompletion": "on", // tab自动不全
"editor.acceptSuggestionOnEnter": "on", // 按回车接受建议
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit" // 自动组织导入顺序
}
}
Cursor AI编辑器
的活动栏设置
Cursor 文档:从 VSCode 迁移
活动栏默认为水平,以节省聊天空间。如果您更喜欢正常的垂直活动栏,您可以转到 VS Code 设置并设置
workbench.activityBar.orientation
为vertical
,然后重新启动 Cursor。
{
"terminal.integrated.defaultProfile.windows": "Git Bash", // 集成终端类型, 这里采用 Git Bash(需要提前下载 Git 工具)
"terminal.external.windowsExec": "E:\\enviroments\\Git\\bin\\bash.exe", // 终端工具路径
"terminal.integrated.fontSize": 22 // 终端字体大小
// "terminal.integrated.defaultProfile.windows":"Command Prompt",
// "terminal.external.windowsExec": "C:\\Windows\\System32\\cmd.exe",
}
{
"javascript.inlayHints.variableTypes.enabled": true, // 启用js中变量的类型提示
"javascript.inlayHints.propertyDeclarationTypes.enabled": true, // 启用(类或构造函数的)属性声明中隐式类型提示
"javascript.inlayHints.functionLikeReturnTypes.enabled": true, // 启用函数返回类型提示
"javascript.inlayHints.parameterNames.enabled": "all", // 启用函数参数名称提示
"javascript.suggest.completeFunctionCalls": true, // 自动完成函数调用时的参数签名(必选参数全部列出来, 可选参数会有提示)
"javascript.suggest.completeJSDocs": true, // 自动完成jsdoc注释
"javascript.format.semicolons": "remove", // js语句末尾分号处理
"javascript.inlayHints.parameterTypes.enabled": false, // 函数参数类型提示
"javascript.updateImportsOnFileMove.enabled": "always" // 重命名或移动文件时自动更新导入路径
}
{
"typescript.suggest.paths": true, // ts语言中import导入时的路径提示
"typescript.suggest.completeJSDocs": true, // 自动完成jsdoc注释
"typescript.updateImportsOnFileMove.enabled": "always", // 重命名或移动文件时自动更新导入路径
"typescript.inlayHints.variableTypes.enabled": false, // 启用ts中变量的类型提示
"typescript.inlayHints.propertyDeclarationTypes.enabled": false, // 启用(类或构造函数的)属性声明中隐式类型提示
"typescript.inlayHints.functionLikeReturnTypes.enabled": false, // 启用函数返回类型提示
"typescript.inlayHints.parameterNames.enabled": "none", // 启用函数参数名称提示
"typescript.suggest.completeFunctionCalls": false, // 自动完成函数调用时的参数签名(必选参数全部列出来, 可选参数会有提示)
"typescript.format.semicolons": "insert", // ts语句末尾分号处理
"typescript.format.insertSpaceBeforeFunctionParenthesis": true, // 函数名和括号之间是否有空格
"typescript.format.placeOpenBraceOnNewLineForFunctions": false, // 函数定义时是否换行
"typescript.format.placeOpenBraceOnNewLineForControlBlocks": false, // 控制语句块是否换行
"typescript.format.insertSpaceBeforeAndAfterBinaryOperators": true // 二元运算符前后是否插入空格
}
插件名称 | 插件描述 |
---|---|
Prettier - Code formatter | 代码格式化 |
HTML CSS Support | HTML CSS 智能提示 |
Vue Official | Vue 代码支持 |
Markdown All in One | Markdown 支持 |
Tailwind CSS IntelliSense | Tailwind CSS 智能提示 |
Nginx Formatter | Nginx 配置文件格式化 |
Markdown All in One | Markdown 支持 |
{
"[html]": {
"editor.defaultFormatter": "ecmel.vscode-html-css"
},
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"typescript.suggest.enabled": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "yzhang.markdown-all-in-one" // markdown格式化插件来格式化代码
},
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// 开启编写类名中的字符串时的建议
"editor.quickSuggestions": {
"strings": "on"
},
// 开启对使用 div.bg-green-100 这种方式的对 Tailwind CSS 建议的支持
"tailwindCSS.emmetCompletions": true,
// 将 Tailwind CSS 与纯文本文件关联
"tailwindCSS.includeLanguages": {
"plaintext": "html"
},
/** 启用 IntelliCode 插件的智能补全 */
"vsintellicode.typescript.completionsEnabled": true,
/** nginx 配置文件格式化设置 */
"[nginx]": {
"editor.defaultFormatter": "teclado.vscode-nginx-format"
}
}
插件名称 | 插件描述 |
---|---|
Comment Translate | 注释文档翻译 |
{
"commentTranslate.source": "Bing", // 翻译源服务器
"commentTranslate.browse.mode": "contrast", // 对比翻译模式
"commentTranslate.multiLineMerge": true, // 多行注释翻译
"commentTranslate.targetLanguage": "zh-CN", // 翻译目标语言
"commentTranslate.hover.concise": true // 悬停翻译
}
{
"window.zoomLevel": 1, // 窗口放大级别, 数字越大, 窗口放大越大. Ctrl + -/+ 控制窗口大小
"window.customTitleBarVisibility": "windowed", // 开启命令中心
"window.commandCenter": false // 关闭窗口顶部的命令中心输入框
}
{
"zenMode.centerLayout": false, // 禅模式下是否使用居中布局
"zenMode.hideLineNumbers": false, // 禅模式是否隐藏行号
"zenMode.hideStatusBar": false // 控制在打开禅模式时是否隐藏工作台底部的状态栏
}
{
"files.associations": {
"*.mts": "typescript",
"*.ts": "typescript",
"*.json": "jsonc"
}
}
插件名称 | 插件描述 |
---|---|
SCSS Formatter | SCSS 代码格式化 |
Live Sass Compiler | SCSS 实时编译(直接启动即可,超级方便) |
{
/** scss格式化插件 */
"[scss]": {
"editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter" // scss格式化插件来格式化代码
},
"liveSassCompile.settings.formats": [
{
/* nested: 嵌套格式, expanded: 展开格式, compact: 紧凑格式, compressed: 压缩格式 */
"format": "expanded", // 编译的css格式
"extensionName": ".css", // 扩展名
"savePath": "/dist" // 保存路径(null 的话, 保存到和源文件同一目录。 ~、/标识当前VSCode打开的项目根目录)
}
],
/* 排除目录 */
"liveSassCompile.settings.excludeList": ["/**/node_modules/**", "/.vscode/**"],
/*包含编译的文件*/
"liveSassCompile.settings.includeItems": [
"/src/**/**.scss" // 有哪些目录下的scss文件需要编译,就包括在这里来
],
/* 是否生成对应的 map 文件*/
"liveSassCompile.settings.generateMap": false,
// 是否添加浏览器兼容前缀, 设置为false,那么不管浏览器兼容问题,只生成标准的css
"liveSassCompile.settings.autoprefix": false
/*"liveSassCompile.settings.autoprefix": [
"> 1%", // 兼容最新的浏览器版本
"last 2 versions", // 兼容最新两个版本
]*/
}
{
// 格式化设置
"editor.defaultFormatter": "esbenp.prettier-vscode", // 指定编辑器默认格式化程序, 提供丰富的语言支持
"prettier.semi": false, // 控制语句是否使用分号结尾
"prettier.singleQuote": true, // 是否使用单引号
"prettier.trailingComma": "all", // 控制多行结构最后一个元素后是否添加逗号
"prettier.arrowParens": "always", // 箭头函数单个参数时是否添加括号
"prettier.singleAttributePerLine": true, // 当个属性占一行
"prettier.bracketSameLine": true, // 关闭标签与属性是否放在同一行
"prettier.bracketSpacing": true, // 在对象或数组的括号之间是否添加空格
"prettier.useTabs": true, // 是否使用制表符缩进
"prettier.tabWidth": 4, // tab宽度
"prettier.jsxSingleQuote": true, // jsx使用单引号
"prettier.printWidth": 120 // 超过最大值换行
}
~/.ssh/config
):Host redhat
HostName 192.168.106.129
User root
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
ServerAliveInterval 300 // 服务端心跳检测间隔时间
ServerAliveCountMax 300 // 服务端保持会话活跃的重试次数
settings.json
):{
// 窗口
"window.zoomLevel": 1, // 窗口放大级别, 数字越大, 窗口放大越大. Ctrl + -/+ 控制窗口大小
"window.customTitleBarVisibility": "windowed", // 开启命令中心
"window.commandCenter": false, // 关闭窗口顶部的命令中心输入框
// 工作台
"workbench.tree.indent": 16, // 目录树视图缩进宽度
"workbench.colorTheme": "Monokai Pro (Filter Spectrum)", // 主题颜色
"workbench.iconTheme": "material-icon-theme", // 文件图标主题(特别的文件会显示特殊图标)
"workbench.editor.enablePreview": true, // 禁用预览模式.
"workbench.list.openMode": "doubleClick", // 控制如何打开文件项,双击或单击
// 安全
"security.workspace.trust.untrustedFiles": "open", // 打开文件时不要提示 "是否安全信任"
"security.promptForLocalFileProtocolHandling": false, // 在使用本地协议打开文件时不要弹出提示
// 资源管理器
"explorer.confirmDelete": false, // 删除文件时, 不需要再确认是否放入回收站
"explorer.confirmDragAndDrop": false, // 拖拽文件到其他目录中时不再需要确认
"explorer.confirmPasteNative": true, // 在复制粘贴文件时, 不需要确认是否覆盖
"explorer.compactFolders": false, // 关闭单文件目录与子文件名称压缩在一行上显示
"explorer.autoReveal": false, // 控制资源管理器是否应在打开文件时自动显示并选择文件
// 编辑器
"editor.fontSize": 16, // 编辑区字体大小
"editor.tabSize": 4, // 一个 tab 等于的空格数
"editor.wordWrap": "on", // 控制超过视区宽度自动折行、换行
"editor.formatOnSave": true, // 在保存时自动格式化
"editor.mouseWheelZoom": true, // 鼠标滚轮缩放编辑区字体大小
"editor.minimap.enabled": false, // 是否显示缩略图
"editor.minimap.maxColumn": 120, // 控制缩略图的宽度
"editor.lineNumbers": "on", // 编辑区行号显示
"editor.suggest.showIcons": true, // 控制是否在内联建议中显示或隐藏图标。
"editor.suggest.showInlineDetails": true, // 是否显示具体的提示内容
"editor.suggest.showMethods": true, // 显示方法建议
"editor.accessibilitySupport": "off", // 启用无障碍支持
"diffEditor.wordWrap": "on", // 文本将在视区宽度处换行
"editor.fontFamily": "Cascadia Code Extralight, 'Cascadia Mono', Consolas", // 编辑区字体
"editor.fontLigatures": true, // 启用字体连字(如果字体支持连字会显示连字)
"editor.stickyScroll.enabled": false, // 滚动过程中, 显示当前行所属的作用域(默认 true)
"files.autoSave": "off", // 在窗口改变时(从vscode到别的窗口)自动保存文件,可选值: onFocusChange, onWindowChange, off, afterDelay, 为了避免有时候切换窗口时还并不想保存却自动保存了,所以关闭此功能
"editor.insertSpaces": true, // 插入空格
"editor.detectIndentation": true, // 启用自动检测缩进
"editor.indentSize": 2, // 一个缩进的宽度
"editor.tabCompletion": "on", // tab自动不全
"editor.acceptSuggestionOnEnter": "on", // 按回车接受建议
"editor.codeActionsOnSave": {
"source.organizeImports": "never", // 自动组织导入
"source.sortImports": "explicit" // 自动顺序导入
},
// 终端
"terminal.integrated.defaultProfile.windows": "Git Bash", // 集成终端类型, 这里采用 Git Bash(需要提前下载 Git 工具)
"terminal.external.windowsExec": "E:\\enviroments\\Git\\bin\\bash.exe", // 终端工具路径
"terminal.integrated.fontSize": 22, // 终端字体大小
// 文档注释翻译
"commentTranslate.source": "Bing", // 翻译源服务器
"commentTranslate.browse.mode": "contrast", // 对比翻译模式
"commentTranslate.multiLineMerge": true, // 多行注释翻译
"commentTranslate.targetLanguage": "zh-CN", // 翻译目标语言
"commentTranslate.hover.concise": true, // 悬停翻译
// 禅模式
"zenMode.centerLayout": false, // 禅模式下是否使用居中布局
"zenMode.hideLineNumbers": false, // 禅模式是否隐藏行号
"zenMode.hideStatusBar": false, // 控制在打开禅模式时是否隐藏工作台底部的状态栏
// prettier 格式化配置
"editor.defaultFormatter": "esbenp.prettier-vscode", // 指定编辑器默认格式化程序, 提供丰富的语言支持
"prettier.semi": false, // 控制语句是否使用分号结尾
"prettier.singleQuote": true, // 是否使用单引号
"prettier.trailingComma": "all", // 控制多行结构最后一个元素后是否添加逗号
"prettier.arrowParens": "always", // 箭头函数单个参数时是否添加括号
"prettier.singleAttributePerLine": true, // 当个属性占一行
"prettier.bracketSameLine": true, // 关闭标签与属性是否放在同一行
"prettier.bracketSpacing": true, // 在对象或数组的括号之间是否添加空格
"prettier.useTabs": true, // 是否使用制表符缩进
"prettier.tabWidth": 4, // tab宽度
"prettier.jsxSingleQuote": true, // jsx使用单引号
"prettier.printWidth": 120, // 超过最大值换行
// 语言格式化 - 全局配置
"[html]": {
"editor.defaultFormatter": "ecmel.vscode-html-css"
},
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"typescript.suggest.enabled": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "yzhang.markdown-all-in-one" // markdown格式化插件来格式化代码
},
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// tailwindcss 类名智能提示
"editor.quickSuggestions": {
"strings": "on" // 开启编写类名中的字符串时的建议
},
// 开启对使用 div.bg-green-100 这种方式的对 Tailwind CSS 建议的支持
"tailwindCSS.emmetCompletions": true,
// 将 Tailwind CSS 与纯文本文件关联
"tailwindCSS.includeLanguages": {
"plaintext": "html"
},
/** 启用 IntelliCode 插件的智能补全 */
"vsintellicode.typescript.completionsEnabled": true,
/** nginx 配置文件格式化设置 */
"[nginx]": {
"editor.defaultFormatter": "teclado.vscode-nginx-format"
},
// cursor 的活动栏方向配置
"workbench.activityBar.orientation": "vertical"
}
快捷键 | 功能 |
---|---|
Ctrl + Shift + P | 命令快捷查找窗口 |
Ctrl + K, Ctrl + S | 打开命令快捷键设置 |
Ctrl + , | 打开设置 |
Ctrl + Shift + , | 打开 json 配置文件 |
Ctrl + Shift + N | 打开新的 VSCode 窗口 |
Ctrl + P | 函数参数提示 |
Ctrl + I | 详情提示,智能提示 |
Ctrl + T, Ctrl + N | 创建新终端 |
Ctrl + T, Ctrl + K | 拆分终端 |
Ctrl + T, Ctrl + D | 销毁当前活动终端实例 |
Ctrl + Shift + C | 打开新的外部终端(终端路径是当前项目根路径) |
Ctrl + J | 显示/隐藏活动面板 |
Alt + Shift + R | 打开当前选中的文件所在位置的资源管理器 |
Alt + Shift + F | 格式化代码 |
Ctrl + K, Ctrl + T | 切换主题(通过上下键选择,回车确认使用) |
Alt + Shift + Z | 翻译对比显示 |
Alt + Shift + B | 原地占位替换显示/生成运行任务(比如构建 TS 编译任务) |
PgUp | 窗口可见行数向上翻页 |
PgOn | 窗口可见行数向下翻页 |
Ctrl + Shift + Z | 搜狗输入法的符号大全 |
说明:
找到左下角
齿轮
>用户代码片段
> 搜索对应的xxx.json
(代码片段)配置的json
文件 >自定义或者直接粘贴下面的代码
>保存(没有及时生效的话重启一下VSCode)
比如配置好下面的
vue.json
文件后, 通过v2init
快捷键即可生成vue2
的组件模板, 通过v3init
即可生成vue3
的组件模板.
{
"vue2 模板": {
"prefix": "v2init",
"body": [
"<template>",
"\t<div>",
"\t\t$1",
"\t</div>",
"</template>",
"",
"<script>",
"\texport default {",
"\tname: '$2'",
"\tdata () {",
"\t\treturn {",
"\t\t\t$3",
"\t\t}",
"\t},",
"\tmethods: {",
"\t\t$4",
"\t},",
"\tcomputed: {",
"\t\t$5",
"\t},",
"\tcomponents: {",
"\t\t$6",
"\t},",
"}",
"</script>",
"",
"<style scoped>",
"\t$0",
"</style>"
],
"description": "粘贴 Vue2 组件基本模板代码"
},
"vue3 模板": {
"prefix": "v3init",
"body": [
"<script setup lang='$1'>",
"\timport { ref } from 'vue'",
"</script>",
"",
"<template>",
"\t<div>",
"\t\t$2",
"\t</div>",
"</template>",
"",
"<style scoped lang='$3'>",
"\t$0",
"</style>"
],
"description": "粘贴 Vue3 组件基本模板代码"
}
}
{
"Print to console": {
"prefix": "clg",
"body": ["console.log($1);", "$2"],
"description": "log to console"
},
"warnings to console": {
"prefix": "clw",
"body": ["console.warn($1);", "$2"],
"description": "warnings to console"
},
"info to console": {
"prefix": "cli",
"body": ["console.info($1);", "$2"],
"description": "info to console"
},
"error to console": {
"prefix": "cle",
"body": ["console.error($1);", "$2"],
"description": "error to console"
},
"table to console": {
"prefix": "clt",
"body": ["console.table($1);", "$2"],
"description": "table to console"
}
}
{
"初始化html基本结构": {
"prefix": "!",
"body": [
"<!DOCTYPE html>",
"<html lang='zh-CN'>",
"<head>",
"\t<meta charset='UTF-8'>",
"\t<meta name='viewport' content='width=device-width, initial-scale=1.0'>",
"\t<meta name='keywords' content='关键字'>",
"\t<meta name='description' content='描述'>",
"\t<meta name='author' content='作者'>",
"\t<title>初始化html结构</title>",
"</head>",
"<body>",
"\t<div id='app'>",
"\t</div>",
"\t<script>",
"\t\t$0",
"\t</script>",
"</body>",
"</html>"
],
"description": "初始化html基本结构"
}
}
说明
snippet 由三部分组成:
prefix
:『前缀』(触发智能提示),定义了 snippets 从 IntelliSense(智能感应)中呼出的关键字(通过该前缀触发你的代码片段选项供你选择);body
: 『主体』(代码片段内容),即模板的主体内容,每个字符串表示一行;description
:『说明』(说明该代码片段的作用),会在 IntelliSense 候选栏中出现。未定义的情况下显示对象名,上例中将会显示 Print to console。