1. Download and official website tutorial
- Download link: https://code.visualstudio.com/
- Official tutorial: https://code.visualstudio.com/docs
2. Install the plugin
There are three ways to install extensions:
- Selection
Code>Preferences>Extensions
; - Use shortcut keys
Ctrl+Shift+X
; - Use shortcut keys
Ctrl+Shift+P
to enter the command panel, enter theExtensions: Install Extensions
search extension and install it;
3. Customize the template
Select Code>Preferences>User Snippets
or use the shortcut keys Ctrl+Shift+P
to enter the command panel, input Preferences: Configure User Snippets
manage custom code segments.
Click New Global Snippets file...
New Custom code snippet:custom.code-snippets
{
"Author Info": {
"scope": "cpp,go, python",
"prefix": "author",
"body": [
"/**",
"* $1",
"* @author wohu",
"*/",
"$2"
],
"description": "Author Infomartion"
}
}
After the above-described configuration custom code stored in the cpp,go, python
input file author
to generate self-defined code segment.
4. Custom configuration parameters
Enter the shortcut key Ctrl+,
to enter the configuration page, search for keywords to adjust the configuration parameters.
Can also settings.json
edit custom configuration:
{
"editor.fontSize": 14, // 字体大小
"editor.formatOnSave": true, // 保存时自动格式化
"files.autoSave": "onFocusChange", // 失去焦点时自动保存文件
"breadcrumbs.enabled": true, // 显示文件路径
"window.zoomLevel": 0, // 窗口缩放比例
"workbench.statusBar.visible": true, // 隐藏底部状态栏
"workbench.colorTheme": "An Old Hope Italic" // 编辑器主题
}
5. Custom Theme
VS Code built many different styles of theme editor, enter the shortcut key to Ctrl+K、Ctrl+T
pop up the theme selection screen, you can choose own theme. You can also install third-party themes in the extension center and then enable them here.
You can also select the menu: File> Preferences> Color Theme
6. Configuration parameter description
{
"editor.fontSize": 14, // 字体大小
"editor.formatOnSave": true, // 保存时自动格式化
"files.autoSave": "onFocusChange", // 失去焦点时自动保存文件
"breadcrumbs.enabled": true, // 显示文件路径
"window.zoomLevel": 0, // 窗口缩放比例
"workbench.statusBar.visible": true, // 隐藏底部状态栏
"workbench.colorTheme": "An Old Hope Italic", // 编辑器主题
"workbench.iconTheme": "eq-material-theme-icons-ocean", // 图标主题
"workbench.startupEditor": "newUntitledFile", // 编辑器欢迎设置
"explorer.confirmDragAndDrop": false, // 移动文件时是否需要确认
"explorer.confirmDelete": false, // 删除文件时是否需要确认
// 优化右侧预览地图样式
"editor.minimap.renderCharacters": false,
"editor.minimap.maxColumn": 200,
"editor.minimap.showSlider": "always",
// go开发配置
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave": false,
"go.autocompleteUnimportedPackages": true,
"go.useLanguageServer": true,
"go.inferGopath": true,
"go.docsTool": "godoc",
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.formatTool": "goreturns",
"go.gocodeAutoBuild": false,
"go.liveErrors": {
"enabled": true,
"delay": 0
},
"go.gopath": "/data/go",
"go.goroot": "/usr/local/go/1.12.7/libexec"
}
7. Extension
- Bracket Pair Colorizer : color the brackets in pairs
- Code Runner : Directly run code written in various languages
- GitLens : Git source code management plugin
- Settings Sync : VS Code configuration synchronization plug-in
- DotENV : .env file highlighting plugin
- Vim : Use the Vim plug-in in VS Code
- Beautify : Code Beautification Plugin
- Markdown Preview Enhanced : Markdown preview plugin
- Markdown PDF : plug-in to export PDF files according to Markdown files