本人自己用戶配置
{
"git.ignoreMissingGitWarning": true,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"window.zoomLevel": 1,
"javascript.implicitProjectConfig.experimentalDecorators": true,
"workbench.editor.enablePreview": false,
"editor.tabSize": 2,
"workbench.editor.enablePreview": false,
"emmet.syntaxProfiles": {
"javascript": "jsx"
},
"git.confirmSync": false,
"git.autofetch": true,
"editor.detectIndentation": false,
"prettier.singleQuote": true,
"extensions.ignoreRecommendations": false,
"editor.formatOnSave": true,
"liveServer.settings.donotShowInfoMsg": true,
"fileheader.Author": "lin.zehong",
"fileheader.LastModifiedBy": "lin.zehong",
"fileheader.tpl": "/*\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by: {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n * @Desc: 描述 \r\n */\r\n"
}
注意:這里安裝的其中一個(gè)插件 vscode-fileheader孩擂,是對(duì)于頭文件的配置逮光;
默認(rèn)快捷鍵為 ctrl+alt+i 焚鹊,本地修改的快捷鍵為:ctrl+shift+a
主命令框
F1 或 Ctrl+Shift+P: 打開命令面板诗芜。在打開的輸入框內(nèi)恨闪,可以輸入任何命令究飞,例如:
按一下 Backspace 會(huì)進(jìn)入到 Ctrl+P 模式
在 Ctrl+P 下輸入 > 可以進(jìn)入 Ctrl+Shift+P 模式
在 Ctrl+P 窗口下還可以:
- 直接輸入文件名域蜗,跳轉(zhuǎn)到文件
- ? 列出當(dāng)前可執(zhí)行的動(dòng)作
- ! 顯示 Errors或 Warnings巨双,也可以 Ctrl+Shift+M
- : 跳轉(zhuǎn)到行數(shù),也可以 Ctrl+G 直接進(jìn)入
- @ 跳轉(zhuǎn)到 symbol(搜索變量或者函數(shù))霉祸,也可以 Ctrl+Shift+O 直接進(jìn)入
- @ 根據(jù)分類跳轉(zhuǎn) symbol筑累,查找屬性或函數(shù),也可以 Ctrl+Shift+O 后輸入:進(jìn)入
- # 根據(jù)名字查找 symbol丝蹭,也可以 Ctrl+T
常用快捷鍵
編輯器與窗口管理
打開一個(gè)新窗口: Ctrl+Shift+N
關(guān)閉窗口: Ctrl+Shift+W
同時(shí)打開多個(gè)編輯器(查看多個(gè)文件)
新建文件 Ctrl+N
文件之間切換 Ctrl+Tab
切出一個(gè)新的編輯器(最多 3 個(gè)) Ctrl+\慢宗,也可以按住 Ctrl 鼠標(biāo)點(diǎn)擊 Explorer 里的文件名
左中右 3 個(gè)編輯器的快捷鍵 Ctrl+1 Ctrl+2 Ctrl+3
3 個(gè)編輯器之間循環(huán)切換 Ctrl+
編輯器換位置, Ctrl+k然后按 Left或 Right
代碼編輯
格式調(diào)整
代碼行縮進(jìn) Ctrl+[ 奔穿、 Ctrl+]
Ctrl+C 镜沽、 Ctrl+V 復(fù)制或剪切當(dāng)前行/當(dāng)前選中內(nèi)容
代碼格式化: Shift+Alt+F,或 Ctrl+Shift+P 后輸入 format code
上下移動(dòng)一行: Alt+Up 或 Alt+Down
向上向下復(fù)制一行: Shift+Alt+Up 或 Shift+Alt+Down
在當(dāng)前行下邊插入一行 Ctrl+Enter
在當(dāng)前行上方插入一行 Ctrl+Shift+Enter
光標(biāo)相關(guān)
移動(dòng)到行首: Home
移動(dòng)到行尾: End
移動(dòng)到文件結(jié)尾: Ctrl+End
移動(dòng)到文件開頭: Ctrl+Home
移動(dòng)到定義處: F12
定義處縮略圖:只看一眼而不跳轉(zhuǎn)過去 Alt+F12
移動(dòng)到后半個(gè)括號(hào): Ctrl+Shift+]
選擇從光標(biāo)到行尾: Shift+End
選擇從行首到光標(biāo)處: Shift+Home
刪除光標(biāo)右側(cè)的所有字: Ctrl+Delete
擴(kuò)展/縮小選取范圍: Shift+Alt+Left 和 Shift+Alt+Right
多行編輯(列編輯):Alt+Shift+鼠標(biāo)左鍵贱田,Ctrl+Alt+Down/Up
同時(shí)選中所有匹配: Ctrl+Shift+L
Ctrl+D 下一個(gè)匹配的也被選中 (在 sublime 中是刪除當(dāng)前行缅茉,后面自定義快鍵鍵中,設(shè)置與 Ctrl+Shift+K 互換了)
回退上一個(gè)光標(biāo)操作: Ctrl+U
重構(gòu)代碼
找到所有的引用: Shift+F12
同時(shí)修改本文件中所有匹配的: Ctrl+F12
重命名:比如要修改一個(gè)方法名男摧,可以選中后按 F2蔬墩,輸入新的名字,回車耗拓,會(huì)發(fā)現(xiàn)所有的文件都修改了
跳轉(zhuǎn)到下一個(gè) Error 或 Warning:當(dāng)有多個(gè)錯(cuò)誤時(shí)可以按 F8 逐個(gè)跳轉(zhuǎn)
查看 diff: 在 explorer 里選擇文件右鍵 Set file to compare拇颅,然后需要對(duì)比的文件上右鍵選擇 Compare with file_name_you_chose
查找替換
查找 Ctrl+F
查找替換 Ctrl+H
整個(gè)文件夾中查找 Ctrl+Shift+F
顯示相關(guān)
全屏:F11
zoomIn/zoomOut:Ctrl +/-
側(cè)邊欄顯/隱:Ctrl+B
顯示資源管理器 Ctrl+Shift+E
顯示搜索 Ctrl+Shift+F
顯示 Git Ctrl+Shift+G
顯示 Debug Ctrl+Shift+D
顯示 Output Ctrl+Shift+U
其他
自動(dòng)保存:File -> AutoSave ,或者 Ctrl+Shift+P乔询,輸入 auto
修改默認(rèn)快捷鍵
打開默認(rèn)鍵盤快捷方式設(shè)置:
File -> Preferences -> Keyboard Shortcuts樟插,或者:Alt+F -> p -> k
修改 keybindings.json:
// 將鍵綁定放入此文件中以覆蓋默認(rèn)值
// Place your key bindings in this file to overwrite the defaults
[
// ctrl+space 被切換輸入法快捷鍵占用
{
"key": "ctrl+alt+space",
"command": "editor.action.triggerSuggest",
"when": "editorTextFocus"
},
// ctrl+d 刪除一行
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "editorTextFocus"
},
// 與刪除一行的快捷鍵互換
{
"key": "ctrl+shift+k",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
// ctrl+shift+/多行注釋
{
"key":"ctrl+shift+/",
"command": "editor.action.blockComment",
"when": "editorTextFocus"
},
// 定制與 sublime 相同的大小寫轉(zhuǎn)換快捷鍵,需安裝 TextTransform 插件
{
"key": "ctrl+k ctrl+u",
"command": "uppercase",
"when": "editorTextFocus"
},
{ "key": "ctrl+alt+down", "command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly" },
{ "key": "ctrl+alt+up", "command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly" },
{
"key": "ctrl+k ctrl+l",
"command": "lowercase",
"when": "editorTextFocus"
}
]
用戶設(shè)置
{
//縮進(jìn)問題
"editor.tabSize": 2,
"editor.detectIndentation": false
}
前端開發(fā)必備插件
- PostCSS Sorting
- stylelint
- stylefmt
- ESLint
- javascript standard format
- beautify
- Babel ES6/ES7
- Debugger for Chrome
- Add jsdoc comments
- javascript(ES6) code snippets
- vue
- weex
- Reactjs code snippets
- React Native Tools
- Npm Intellisense
- Instant Markdown
- Markdown Shortcuts
- TextTransform
- vscode-fileheader(頭文件)
自定義設(shè)置參考
vscode 自定義配置參考:
{
"editor.fontSize": 18,
"files.associations": {
".es": "javascript",
".es6": "javascript"
},
// 控制編輯器是否應(yīng)呈現(xiàn)空白字符
"editor.renderWhitespace": true,
// 啟用后竿刁,將在保存文件時(shí)剪裁尾隨空格黄锤。
"files.trimTrailingWhitespace": true,
// File extensions that can be beautified as javascript or JSON.
"beautify.JSfiles": [
"",
"es",
"es6",
"js",
"json",
"jsbeautifyrc",
"jshintrc"
]
}
谷歌默認(rèn)配置
{
// 使用 IntelliSense 了解相關(guān)屬性。
// 懸停以查看現(xiàn)有屬性的描述食拜。
// 欲了解更多信息猜扮,請(qǐng)?jiān)L問: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
react 修改谷歌默認(rèn)配置
{
"version": "0.2.0",
"configurations": [{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src",
"userDataDir": "${workspaceRoot}/.vscode/chrome",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}]
}
隨記
vsCode 代碼規(guī)范:
對(duì)于 ‘LF’的問題,安裝EditorConfig插件监婶,在配置文件中配置
end_of_line = lf
單引號(hào)變?yōu)殡p引號(hào):"prettier.singleQuote": true
相關(guān)參考
官方快捷鍵大全:https://code.visualstudio.com/docs/customization/keybindings
http://blog.csdn.net/u010019717/article/details/50443970
https://www.cnblogs.com/bindong/p/6045957.html