Skip to content

Instantly share code, notes, and snippets.

@samyarkd
Last active July 7, 2025 13:04
Show Gist options
  • Save samyarkd/61752be69e485323d665aab42436ed2c to your computer and use it in GitHub Desktop.
Save samyarkd/61752be69e485323d665aab42436ed2c to your computer and use it in GitHub Desktop.
My Vscode Vim config and keybinding
[
{
"key": "ctrl+j", // toggle terminal
"command": "workbench.action.terminal.toggleTerminal",
},
{
"key": "h", // scrol left through hover info
"command": "editor.action.scrollLeftHover",
"when": "editorHoverFocused"
},
{
"key": "j", // scrol down through hover info
"command": "editor.action.scrollDownHover",
"when": "editorHoverFocused"
},
{
"key": "k", // scrol up through hover info
"command": "editor.action.scrollUpHover",
"when": "editorHoverFocused"
},
{
"key": "l", // scrol right through hover info
"command": "editor.action.scrollRightHover",
"when": "editorHoverFocused"
},
{
"key": "space e", // toggle file explorer
"command": "workbench.action.toggleSidebarVisibility",
"when": "filesExplorerFocus && !inputFocus"
},
{
"key": "a", // new file in file explorer
"command": "explorer.newFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "f", // new folder
"command": "explorer.newFolder",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "r", // rename file
"command": "renameFile",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "x", // cut file
"command": "filesExplorer.cut",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "y", // yank/copy file
"command": "filesExplorer.copy",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
},
{
"key": "p", // paste file in file explorer
"command": "filesExplorer.paste",
"when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
},
{
"key": "ctrl+p",
"command": "workbench.actions.view.problems", // open diagnostics
},
// Move line up and down
{
"key": "alt+j",
"command": "editor.action.moveLinesDownAction", // move line down
"when": "editorFocus"
},
{
"key": "alt+k",
"command": "editor.action.moveLinesUpAction", // move line up
"when": "editorFocus"
},
{
"key": "space space",
"command": "workbench.action.quickOpen", // open quick file access
"when": "!editorFocus && !editorIsOpen && !terminalFocus"
},
]
{
"vim.useSystemClipboard": true,
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"j"
],
"after": [
"g",
"j"
]
},
{
"before": [
"k"
],
"after": [
"g",
"k"
]
}
],
"vim.highlightedyank.enable": true,
"vim.highlightedyank.color": "#a9dc7660",
"vim.highlightedyank.duration": 250,
"vim.foldfix": true, // skips folds
"vim.leader": "<space>", // leader key
"vim.visualModeKeyBindings": [
{
"before": [
"<C-space>",
],
"commands": [
"editor.action.smartSelect.expand", // select code blocks
]
},
{
"before": [
"<leader>",
"a",
"a",
],
"commands": [
"workbench.action.openQuickChat", // open copilot quick chat
]
},
],
"vim.normalModeKeyBindings": [
{
"before": [
"<leader>",
"a",
"a",
],
"commands": [
"workbench.action.openQuickChat", // open copilot quick chat
]
},
{
"before": [
"<S-l>",
],
"commands": [
"workbench.action.nextEditor", // next open file
]
},
{
"before": [
"<S-h>",
],
"commands": [
"workbench.action.previousEditor", // prev open file
]
},
{
"before": [
"<C-space>",
],
"commands": [
"editor.action.smartSelect.expand", // select code blocks
]
},
{
"before": [
"<leader>",
"c",
"p"
],
"commands": [
"workbench.action.showCommands", // open command plate
]
},
{
"before": [
"<leader>",
"b",
"d"
],
"commands": [
"workbench.action.closeActiveEditor", // close current open file
]
},
{
"before": [
"<leader>",
"b",
"a"
],
"commands": [
"workbench.action.closeAllEditors", // close all files
]
},
{
"before": [
"<leader>",
"b",
"r"
],
"commands": [
"workbench.action.closeOtherEditors", // close other files
]
},
{
"before": [
"<leader>",
"e"
],
"commands": [
"workbench.view.explorer", // open file explorer
]
},
// LSP keybindings
{
"before": [
"g",
"p",
"d"
],
"commands": [
"editor.action.peekDefinition"
]
},
{
"before": [
"g",
"h"
],
"commands": [
"editor.action.showDefinitionPreviewHover"
]
},
{
"before": [
"g",
"i"
],
"commands": [
"editor.action.goToImplementation"
]
},
{
"before": [
"g",
"p",
"i"
],
"commands": [
"editor.action.peekImplementation"
]
},
{
"before": [
"c",
"a"
],
"commands": [
"editor.action.quickFix"
]
},
{
"before": [
"g",
"r"
],
"commands": [
"editor.action.referenceSearch.trigger"
]
},
{
"before": [
"g",
"t"
],
"commands": [
"editor.action.goToTypeDefinition"
]
},
{
"before": [
"g",
"p",
"t"
],
"commands": [
"editor.action.peekTypeDefinition"
]
},
{
"before": [
"<S-k>"
],
"commands": [
"editor.action.showDefinitionPreviewHover" // show hover information
]
},
{
"before": [
"<leader>",
"o",
"l"
],
"commands": [
"editor.action.openLink" // open the link that the cursor is on
]
},
{
"before": [
"<leader>",
"<leader>",
],
"commands": [
"workbench.action.quickOpen", // find files
]
},
{
"before": [
"<C-b>",
],
"commands": [
"workbench.action.toggleSidebarVisibility" // toggle sidebar
]
},
{
"before": [
"/"
],
"commands": [
"actions.find" // search in current active file
]
},
{
"before": [
"<leader>",
"g",
"g"
],
"commands": [
"workbench.view.scm" // open git
]
}
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment