Skip to content

Instantly share code, notes, and snippets.

@blackcater
Last active March 31, 2024 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackcater/f9c915f17809139ba16dd7a4f79d8d52 to your computer and use it in GitHub Desktop.
Save blackcater/f9c915f17809139ba16dd7a4f79d8d52 to your computer and use it in GitHub Desktop.
VSCode VIM Settings
// Place your key bindings in this file to override the defaults
[
/// ============================================
/// Common Keybindings
/// ============================================
{
"key": "shift+cmd+t",
"command": "-workbench.action.reopenClosedEditor"
},
{
"key": "shift+cmd+t",
"command": "workbench.view.extension.test"
},
{
"key": "shift+cmd+g",
"command": "-workbench.action.terminal.findPrevious",
"when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
},
{
"key": "shift+cmd+g",
"command": "-editor.action.previousMatchFindAction",
"when": "editorFocus"
},
{
"key": "shift+cmd+g",
"command": "workbench.view.scm",
"when": "workbench.scm.active"
},
{
"key": "ctrl+shift+g",
"command": "-workbench.view.scm",
"when": "workbench.scm.active"
},
{
"key": "shift+cmd+g",
"command": "workbench.view.scm",
"when": "workbench.scm.active && !gitlens:disabled && config.gitlens.keymap == 'chorded'"
},
{
"key": "ctrl+shift+g",
"command": "-workbench.view.scm",
"when": "workbench.scm.active && !gitlens:disabled && config.gitlens.keymap == 'chorded'"
},
{
"key": "ctrl+]",
"command": "workbench.action.navigateForward"
},
{
"key": "ctrl+shift+-",
"command": "-workbench.action.navigateForward"
},
{
"key": "ctrl+[",
"command": "workbench.action.navigateBack"
},
{
"key": "ctrl+-",
"command": "-workbench.action.navigateBack"
},
{
"key": "cmd+k cmd+p",
"command": "workbench.action.toggleAuxiliaryBar"
},
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1",
"when": "editorFocus"
},
{
"key": "cmd+2",
"command": "workbench.action.openEditorAtIndex2",
"when": "editorFocus"
},
{
"key": "cmd+3",
"command": "workbench.action.openEditorAtIndex3",
"when": "editorFocus"
},
{
"key": "cmd+4",
"command": "workbench.action.openEditorAtIndex4",
"when": "editorFocus"
},
{
"key": "cmd+5",
"command": "workbench.action.openEditorAtIndex5",
"when": "editorFocus"
},
/// ============================================
/// VIM Keybindings
/// ============================================
// File Tree
{
"key": "cmd+n",
"command": "explorer.newFile",
"when": "explorerViewletFocus && filesExplorerFocus",
},
{
"key": "ctrl+n",
"command": "explorer.newFolder",
"when": "explorerViewletFocus && filesExplorerFocus"
},
// Terminal Navigation
{
"key": "ctrl+u",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
},
{
"key": "ctrl+d",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "cmd+j",
"command": "workbench.action.terminal.toggleTerminal",
},
{
"key": "ctrl+n",
"command": "workbench.action.terminal.new",
"when": "terminalFocus"
},
{
"key": "ctrl+c",
"command": "workbench.action.terminal.kill",
"when": "terminalFocus"
},
// Panel Navigation
{
"key": "ctrl+h",
"command": "workbench.action.previousPanelView",
"when": "panelFocus"
},
{
"key": "ctrl+l",
"command": "workbench.action.nextPanelView",
"when": "panelFocus"
},
// Move between splitted editors
{
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusRightGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "ctrl+k",
"command": "workbench.action.focusAboveGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "ctrl+j",
"command": "workbench.action.focusBelowGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
// Switch between editors
{
"key": "ctrl+h",
"command": "workbench.action.previousEditor",
"when": "editorTextFocus && !panelFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "ctrl+l",
"command": "workbench.action.nextEditor",
"when": "editorTextFocus && !panelFocus && vim.active && vim.mode != 'Insert'"
},
// List
{
"key": "ctrl+h",
"command": "list.collapse",
"when": "listFocus && !inputFocus"
},
{
"key": "ctrl+l",
"command": "list.expand",
"when": "listFocus && !inputFocus"
},
{
"key": "ctrl+k",
"command": "list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "ctrl+j",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
// suggest
{
"key": "ctrl+j",
"command": "selectNextSuggestion",
"when": "suggestWidgetVisible"
},
{
"key": "ctrl+k",
"command": "selectPrevSuggestion",
"when": "suggestWidgetVisible"
},
// quick open
{
"key": "ctrl+j",
"command": "workbench.action.quickOpenSelectNext",
"when": "inQuickOpen"
},
{
"key": "ctrl+k",
"command": "workbench.action.quickOpenSelectPrevious",
"when": "inQuickOpen"
},
// breadcrumbs
{
"key": "ctrl+h",
"command": "breadcrumbs.focusPrevious",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "ctrl+l",
"command": "breadcrumbs.focusNext",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
]
{
// VIM settings
"vim.easymotion": true,
"vim.surround": true,
"vim.sneak": true,
"vim.incsearch": true,
"vim.hlsearch": true,
"vim.useCtrlKeys": true,
"vim.handleKeys": {
"<C-a>": false,
"<C-e>": false,
"<C-f>": false,
"<C-b>": false,
"<C-[>": false,
"<C-]>": false,
},
"vim.useSystemClipboard": true,
"vim.cursorStylePerMode.visual": "underline-thin",
"vim.cursorStylePerMode.visualblock": "underline",
"vim.leader": "<space>",
"vim.insertModeKeyBindingsNonRecursive": [
{
"before": [
"j",
"k"
],
"after": [
"<esc>"
]
},
{
"before": [
"j",
"j"
],
"after": [
"<esc>"
]
},
],
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"<leader>",
"v"
],
"commands": [
"workbench.action.splitEditor"
]
},
{
"before": [
"<leader>",
"s"
],
"commands": [
"workbench.action.splitEditorDown"
]
},
{
"before": [
"<leader>",
"j"
],
"after": [
"5",
"j"
]
},
{
"before": [
"<leader>",
"k"
],
"after": [
"5",
"k"
]
},
{
"before": [
"<leader>",
"c"
],
"commands": [
"editor.action.commentLine",
]
},
{
"before": [
"<leader>",
"m"
],
"commands": [
"bookmarks.toggle"
]
},
{
"before": [
"<leader>",
"b"
],
"commands": [
"bookmarks.list"
]
},
{
"before": [
"<C-n>"
],
"commands": [
":nohl"
]
},
],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": [
"<leader>",
"c"
],
"commands": [
"editor.action.commentLine",
"extension.vim_escape"
]
}
],
"vim.operatorPendingModeKeyBindings": [],
//- improve performance"
"extensions.experimental.affinity": {
"vscodevim.vim": 1
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment