Skip to content

Instantly share code, notes, and snippets.

@RyoJerryYu
Last active April 17, 2024 12:50
Show Gist options
  • Save RyoJerryYu/3d86f802433f87357de0f3a2a376bf1f to your computer and use it in GitHub Desktop.
Save RyoJerryYu/3d86f802433f87357de0f3a2a376bf1f to your computer and use it in GitHub Desktop.
My VSCode Setting File For Vim Mode

concept

  1. editor moving and splitting
    1. focus around ctrl + shift + hjkl (and change ctrl to command in MacOS)
    2. move editor around ctrl + shift + alt + hjkl (and change ctrl to command in MacOS)
  2. quick moving and slow moving
    1. quick: shift + jk = 10j 10k , shift + hl = ^ $
    2. slow: ctrl + jk = gj gk , ctrl + hl = g^ g$ (used for one long line displayed as multiple line, usually in markdown)
  3. tabbing: tab shift + tab = >> <<
  4. goTos: ga = editor.action.goToImplementation (useful with the default gd gh command)
  5. VSCode original keymapping: ctrl+w , ctrl+t , ctrl+s , ctrl+z , ctrl + shift + f
  6. When focusing VSCode explorer, new file and new folder command: ctrl+n , ctrl+shift+n

vscode shortcut binding

command key before key after why
Delete Line ctrl + shift + k - For Focus Editor up
Go to Bracket ctrl + shift + \ - For Vertical Split
Search: Replace in Files ctrl + shift + h - For Focus Editor Left
View: Split Editor Orthogonal workbench.action.splitEditorOrthogonal ctrl + K ctrl + \ ctrl + shift + \ I'm sure we need it.
View: Focus Left Editor Group workbench.action.focusLeftGroup ctrl + K ctrl + Left ctrl + shift + h For moving windows with hjkl.
View: Focus Right Editor Group workbench.action.focusRightGroup ctrl + K ctrl + Right ctrl + shift + l For moving windows with hjkl.
View: Focus Editor Group Above workbench.action.focusAboveGroup ctrl + K ctrl + Up ctrl + shift + k For moving windows with hjkl.
View: Focus Editor Group Below workbench.action.focusBelowGroup ctrl + K ctrl + Down ctrl + shift + j For moving windows with hjkl.
View: Move Editor into Group Above workbench.action.moveEditorToAboveGroup - ctrl + shift + alt + k For moving windows with hjkl.
View: Move Editor into Group Below workbench.action.moveEditorToBelowGroup - ctrl + shift + alt + j For moving windows with hjkl.
View: Move Editor into Group Left workbench.action.moveEditorToLeftGroup - ctrl + shift + alt + h For moving windows with hjkl.
View: Move Editor into Group Right workbench.action.moveEditorToRightGroup - ctrl + shift + alt + l For moving windows with hjkl.

The json code for vscode shortcut binding is as keybindings.json below.

vscodevim plugin config

The json code for settings is as settings.json below.

[
{
"key": "ctrl+shift+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+shift+l",
"command": "workbench.action.focusRightGroup"
},
{
"key": "ctrl+k ctrl+right",
"command": "-workbench.action.focusRightGroup"
},
{
"key": "ctrl+shift+k",
"command": "workbench.action.focusAboveGroup"
},
{
"key": "ctrl+k ctrl+up",
"command": "-workbench.action.focusAboveGroup"
},
{
"key": "ctrl+shift+j",
"command": "workbench.action.focusBelowGroup"
},
{
"key": "ctrl+k ctrl+down",
"command": "-workbench.action.focusBelowGroup"
},
{
"key": "ctrl+shift+h",
"command": "workbench.action.focusLeftGroup"
},
{
"key": "ctrl+k ctrl+left",
"command": "-workbench.action.focusLeftGroup"
},
{
"key": "ctrl+shift+h",
"command": "-workbench.action.replaceInFiles"
},
{
"key": "ctrl+shift+alt+k",
"command": "workbench.action.moveEditorToAboveGroup"
},
{
"key": "ctrl+shift+alt+j",
"command": "workbench.action.moveEditorToBelowGroup"
},
{
"key": "ctrl+shift+alt+h",
"command": "workbench.action.moveEditorToLeftGroup"
},
{
"key": "ctrl+shift+alt+l",
"command": "workbench.action.moveEditorToRightGroup"
}
]
[
{
"key": "shift+cmd+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "shift+cmd+l",
"command": "workbench.action.focusRightGroup"
},
{
"key": "cmd+k cmd+right",
"command": "-workbench.action.focusRightGroup"
},
{
"key": "shift+cmd+k",
"command": "workbench.action.focusAboveGroup"
},
{
"key": "cmd+k cmd+up",
"command": "-workbench.action.focusAboveGroup"
},
{
"key": "shift+cmd+j",
"command": "workbench.action.focusBelowGroup"
},
{
"key": "cmd+k cmd+down",
"command": "-workbench.action.focusBelowGroup"
},
{
"key": "shift+cmd+h",
"command": "workbench.action.focusLeftGroup"
},
{
"key": "cmd+k cmd+left",
"command": "-workbench.action.focusLeftGroup"
},
{
"key": "shift+alt+cmd+k",
"command": "workbench.action.moveEditorToAboveGroup"
},
{
"key": "shift+alt+cmd+j",
"command": "workbench.action.moveEditorToBelowGroup"
},
{
"key": "shift+alt+cmd+h",
"command": "workbench.action.moveEditorToLeftGroup"
},
{
"key": "shift+alt+cmd+l",
"command": "workbench.action.moveEditorToRightGroup"
},
{
"key": "cmd+j",
"command": "-workbench.action.togglePanel"
},
{
"key": "ctrl+n",
"command": "explorer.newFile",
"when": "explorerViewletFocus"
},
{
"key": "ctrl+shift+n",
"command": "explorer.newFolder",
"when": "explorerViewletFocus"
},
{
"key": "shift+tab",
"command": "-extension.vim_shift+tab",
"when": "editorFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
},
{
"key": "tab",
"command": "-extension.vim_tab",
"when": "editorFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
}
]
{ "vim.useSystemClipboard": true,
"vim.incsearch": true,
"vim.hlsearch": true,
"vim.leader": "<space>",
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": ["J"],
"after": ["1", "0", "j"]
},
{
"before": ["K"],
"after": ["1", "0", "k"]
},
{
"before": ["H"],
"after": ["^"]
},
{
"before": ["L"],
"after": ["$"]
},
{
"before": ["<C-j>"],
"after": ["g", "j"]
},
{
"before": ["<C-k>"],
"after": ["g", "k"]
},
{
"before": ["<C-h>"],
"after": ["g", "^"]
},
{
"before": ["<C-l>"],
"after": ["g", "$"]
},
{
"before": ["<Tab>"],
"after": [">", "g", "v"]
},
{
"before": ["<S-Tab>"],
"after": ["<", "g", "v"]
}
],
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["J"],
"after": ["1", "0", "j"]
},
{
"before": ["K"],
"after": ["1", "0", "k"]
},
{
"before": ["H"],
"after": ["^"]
},
{
"before": ["L"],
"after": ["$"]
},
{
"before": ["<C-j>"],
"after": ["g", "j"]
},
{
"before": ["<C-k>"],
"after": ["g", "k"]
},
{
"before": ["<C-h>"],
"after": ["g", "^"]
},
{
"before": ["<C-l>"],
"after": ["g", "$"]
},
{
"before": ["<Tab>"],
"after": [">", ">"]
},
{
"before": ["<S-Tab>"],
"after": ["<", "<"]
},
{
"before": ["g", "a"],
"commands": ["editor.action.goToImplementation"]
},
{
"before": ["g", "s"],
"commands": ["debug.action.toggleDisassemblyViewSourceCode"]
},
{
"before": ["<leader>", "d"],
"commands": ["go.debug.cursor"]
},
{
"before": ["<leader>", "d", "d"],
"commands": ["go.debug.subtest.cursor"]
},
{
"before": ["<leader>", "d", "s"],
"commands": ["go.test.cursor"]
},
{
"before": ["<leader>", "d", "a"],
"commands": ["go.test.file"]
},
{
"before": ["<leader>", "d", "b"],
"commands": ["editor.debug.action.toggleBreakpoint"]
},
{
"before": ["<leader>", "d", "c"],
"commands": ["workbench.action.debug.continue"]
},
{
"before": ["<leader>", "d", "i"],
"commands": ["workbench.action.debug.stepInto"]
},
{
"before": ["<leader>", "d", "u"],
"commands": ["workbench.action.debug.stepOut"]
},
{
"before": ["<leader>", "d", "o"],
"commands": ["workbench.action.debug.stepOver"]
},
{
"before": ["<leader>", "e"],
"commands": ["workbench.view.explorer"]
},
{
"before": ["<leader>", "o"],
"commands": ["git.openFile"]
},
{
"before": ["<leader>", "c", "p"],
"commands": ["copyRelativeFilePath"]
}
],
"vim.handleKeys": {
"<C-w>": false,
"<C-t>": false,
"<C-d>": true,
"<C-s>": false,
"<C-z>": false,
"<C-F>": false,
"<C-H>": false,
"<C-J>": false,
"<C-K>": false,
"<C-L>": false,
"<C-M-H>": false,
"<C-M-L>": false,
"<C-M-J>": false,
"<C-M-K>": false
},
"vim.statusBarColorControl": true,
"vim.statusBarColors.normal": [
"#8FBCBB",
"#000"
],
"vim.statusBarColors.insert": [
"#BF616A",
"#000"
],
"vim.statusBarColors.visual": [
"#B48EAD",
"#000"
],
"vim.statusBarColors.visualline": [
"#B48EAD",
"#000"
],
"vim.statusBarColors.visualblock": [
"#A3BE8C",
"#000"
],
"vim.statusBarColors.replace": "#D08770",
"vim.statusBarColors.commandlineinprogress": "#007ACC",
"vim.statusBarColors.searchinprogressmode": "#007ACC",
"vim.statusBarColors.easymotionmode": "#007ACC",
"vim.statusBarColors.easymotioninputmode": "#007ACC",
"vim.statusBarColors.surroundinputmode": "#007ACC",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment