Created
April 25, 2024 07:21
-
-
Save zilongshanren/b9199cbe51ebf0d08aa11a0eac1e8fc1 to your computer and use it in GitHub Desktop.
Config your VSCode like Spacemacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Trigger vspacecode in empty editor group | |
{ | |
"key": "space", | |
"command": "vspacecode.space", | |
"when": "activeEditorGroupEmpty && focusedView == '' && !whichkeyActive && !inputFocus" | |
}, | |
// Trigger vspacecode when sidebar is in focus | |
{ | |
"key": "space", | |
"command": "vspacecode.space", | |
"when": "sideBarFocus && !inputFocus && !whichkeyActive" | |
}, | |
// Keybindings required for edamagit | |
// https://github.com/kahole/edamagit#vim-support-vscodevim | |
// Cannot be added to package.json because keybinding replacements | |
{ | |
"key": "tab", | |
"command": "extension.vim_tab", | |
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert' && editorLangId != 'magit'" | |
}, | |
{ | |
"key": "tab", | |
"command": "-extension.vim_tab", | |
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'" | |
}, | |
{ | |
"key": "x", | |
"command": "magit.discard-at-point", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" | |
}, | |
{ | |
"key": "k", | |
"command": "-magit.discard-at-point" | |
}, | |
{ | |
"key": "-", | |
"command": "magit.reverse-at-point", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" | |
}, | |
{ | |
"key": "v", | |
"command": "-magit.reverse-at-point" | |
}, | |
{ | |
"key": "shift+-", | |
"command": "magit.reverting", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" | |
}, | |
{ | |
"key": "shift+v", | |
"command": "-magit.reverting" | |
}, | |
{ | |
"key": "shift+o", | |
"command": "magit.resetting", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" | |
}, | |
{ | |
"key": "shift+x", | |
"command": "-magit.resetting" | |
}, | |
{ | |
"key": "x", | |
"command": "-magit.reset-mixed" | |
}, | |
{ | |
"key": "ctrl+u x", | |
"command": "-magit.reset-hard" | |
}, | |
// Extra ref menu support for edamagit with the key "y" | |
// Cannot be added to package.json because keybinding replacements | |
{ | |
"key": "y", | |
"command": "-magit.show-refs" | |
}, | |
{ | |
"key": "y", | |
"command": "vspacecode.showMagitRefMenu", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode == 'Normal'" | |
}, | |
// Extra refresh menu support for edamagit with the key "g" | |
// Cannot be added to package.json because keybinding replacements | |
{ | |
"key": "g", | |
"command": "-magit.refresh", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" | |
}, | |
{ | |
"key": "g", | |
"command": "vspacecode.showMagitRefreshMenu", | |
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/" | |
}, | |
// Easy navigation in quick open/QuickPick | |
{ | |
"key": "ctrl+j", | |
"command": "workbench.action.quickOpenSelectNext", | |
"when": "inQuickOpen" | |
}, | |
{ | |
"key": "ctrl+k", | |
"command": "workbench.action.quickOpenSelectPrevious", | |
"when": "inQuickOpen" | |
}, | |
// Easy navigation in suggestion/intellisense | |
// Cannot be added to package.json because of conflict with vim's default bindings | |
{ | |
"key": "ctrl+j", | |
"command": "selectNextSuggestion", | |
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" | |
}, | |
{ | |
"key": "ctrl+k", | |
"command": "selectPrevSuggestion", | |
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" | |
}, | |
{ | |
"key": "ctrl+l", | |
"command": "acceptSelectedSuggestion", | |
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" | |
}, | |
// Easy navigation in parameter hint (i.e. traverse the hints when there's multiple overload for one method) | |
// Cannot be added to package.json because of conflict with vim's default bindings | |
{ | |
"key": "ctrl+j", | |
"command": "showNextParameterHint", | |
"when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible" | |
}, | |
{ | |
"key": "ctrl+k", | |
"command": "showPrevParameterHint", | |
"when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible" | |
}, | |
// Easy navigation in code action | |
{ | |
"key": "ctrl+j", | |
"command": "selectNextCodeAction", | |
"when": "codeActionMenuVisible" | |
}, | |
{ | |
"key": "ctrl+k", | |
"command": "selectPrevCodeAction", | |
"when": "codeActionMenuVisible" | |
}, | |
{ | |
"key": "ctrl+l", | |
"command": "acceptSelectedCodeAction", | |
"when": "codeActionMenuVisible" | |
}, | |
// Add ctrl+h/l to navigate in file browser | |
{ | |
"key": "ctrl+h", | |
"command": "file-browser.stepOut", | |
"when": "inFileBrowser" | |
}, | |
{ | |
"key": "ctrl+l", | |
"command": "file-browser.stepIn", | |
"when": "inFileBrowser" | |
}, | |
{ | |
"key": "ctrl+p", | |
"command": "cursorUp", | |
"when": "editorTextFocus && !suggestWidgetVisible && !inRegionMode && vim.mode == 'Insert'" | |
}, | |
{ | |
"key": "ctrl+p", | |
"command": "cursorUpSelect", | |
"when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" | |
}, | |
{ | |
"key": "ctrl+n", | |
"command": "cursorDown", | |
"when": "editorTextFocus && !suggestWidgetVisible && !inRegionMode && vim.mode == 'Insert'" | |
}, | |
{ | |
"key": "ctrl+n", | |
"command": "cursorDownSelect", | |
"when": "editorTextFocus && inRegionMode && vim.mode == 'Insert'" | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.editorAssociations": { | |
"*.vsix": "default" | |
}, | |
"security.workspace.trust.untrustedFiles": "open", | |
"files.autoSave": "afterDelay", | |
"cSpell.diagnosticLevel": "Hint", | |
"[javascript]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, | |
// Vim easymotion is required for Jump menu - <SPC> j | |
"vim.easymotion": true, | |
// Use system clipboard for vim | |
"vim.useSystemClipboard": true, | |
// Trigger the main which key menu with in the active editor with vim | |
// This cannot be put into keybindings.json because it will | |
// create conflict with Vim. | |
// https://github.com/stevenguh/spacecode/issues/3 | |
"vim.normalModeKeyBindingsNonRecursive": [ | |
{ | |
"before": ["<space>"], | |
"commands": ["vspacecode.space"] | |
}, | |
{ | |
"before": [","], | |
"commands": [ | |
"vspacecode.space", | |
{ | |
"command": "whichkey.triggerKey", | |
"args": "m" | |
} | |
] | |
} | |
], | |
"vim.visualModeKeyBindingsNonRecursive": [ | |
{ | |
"before": ["<space>"], | |
"commands": ["vspacecode.space"] | |
}, | |
{ | |
"before": [","], | |
"commands": [ | |
"vspacecode.space", | |
{ | |
"command": "whichkey.triggerKey", | |
"args": "m" | |
} | |
] | |
}, | |
{ | |
"before": [">"], | |
"commands": ["editor.action.indentLines"] | |
}, | |
{ | |
"before": ["<"], | |
"commands": ["editor.action.outdentLines"] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
config vscode as IDE: https://davi.sh/blog/2023/01/vscode-like-emacs/