Skip to content

Instantly share code, notes, and snippets.

@nikolovlazar
Last active July 2, 2024 06:28
Show Gist options
  • Save nikolovlazar/1174876ab2769c52ac9fc1534c557d70 to your computer and use it in GitHub Desktop.
Save nikolovlazar/1174876ab2769c52ac9fc1534c557d70 to your computer and use it in GitHub Desktop.
VSCode key bindings to navigate like Neovim
[
// Navigation
{
"key": "ctrl-h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl-l",
"command": "workbench.action.navigateRight"
},
{
"key": "ctrl-k",
"command": "workbench.action.navigateUp"
},
{
"key": "ctrl-j",
"command": "workbench.action.navigateDown"
},
{
"key": "space ,",
"command": "workbench.action.showAllEditors",
"when": "vim.mode == 'Normal' && (editorTextFocus || !inputFocus)"
},
{
"key": "space e",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.toggleSidebarVisibility",
"workbench.files.action.focusFilesExplorer"
]
},
"when": "vim.mode == 'Normal' && (editorTextFocus || !inputFocus) && !sideBarFocus"
},
{
"key": "space e",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.toggleSidebarVisibility",
"workbench.action.focusActiveEditorGroup"
]
},
"when": "sideBarFocus && !inputFocus"
},
{
"key": "space e",
"when": "vim.mode == 'Normal' && editorTextFocus && foldersViewVisible",
"command": "workbench.action.toggleSidebarVisibility"
},
{
"key": "tab",
"command": "workbench.action.nextEditorInGroup",
"when": "(vim.mode == 'Normal' || vim.mode == 'Visual') && (editorTextFocus || !inputFocus)"
},
{
"key": "shift-tab",
"command": "workbench.action.previousEditorInGroup",
"when": "(vim.mode == 'Normal' || vim.mode == 'Visual') && (editorTextFocus || !inputFocus)"
},
// Coding
{
"key": "shift-j",
"command": "editor.action.moveLinesDownAction",
"when": "vim.mode == 'VisualLine' && editorTextFocus"
},
{
"key": "shift-k",
"command": "editor.action.moveLinesUpAction",
"when": "vim.mode == 'VisualLine' && editorTextFocus"
},
{
"key": "shift-k",
"command": "editor.action.showHover",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space c a",
"command": "editor.action.codeAction",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space c r",
"command": "editor.action.rename",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space c s",
"command": "workbench.action.gotoSymbol",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space b d",
"command": "workbench.action.closeActiveEditor",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space space",
"command": "workbench.action.quickOpen",
"when": "vim.mode == 'Normal' && (editorTextFocus || !inputFocus)"
},
{
"key": "space g d",
"command": "editor.action.revealDefinition",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space g r",
"command": "editor.action.goToReferences",
"when": "vim.mode == 'Normal' && editorTextFocus"
},
{
"key": "space s g",
"command": "workbench.action.findInFiles",
"when": "vim.mode == 'Normal' && (editorTextFocus || !inputFocus)"
},
{
"key": "space g g",
"command": "runCommands",
"when": "vim.mode == 'Normal' && (editorTextFocus || !inputFocus)",
"args": {
"commands": ["workbench.view.scm", "workbench.scm.focus"]
}
},
{
"key": "ctrl-n",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "(vim.mode == 'Normal' || vim.mode == 'Visual') && (editorTextFocus || !inputFocus)"
},
// File Explorer
{
"key": "r",
"command": "renameFile",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "c",
"command": "filesExplorer.copy",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "p",
"command": "filesExplorer.paste",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "x",
"command": "filesExplorer.cut",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "d",
"command": "deleteFile",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "a",
"command": "explorer.newFile",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "shift-a",
"command": "explorer.newFolder",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "s",
"command": "explorer.openToSide",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
},
{
"key": "shift-s",
"command": "runCommands",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus",
"args": {
"commands": [
"workbench.action.splitEditorDown",
"explorer.openAndPassFocus",
"workbench.action.closeOtherEditors"
]
}
},
{
"key": "enter",
"command": "explorer.openAndPassFocus",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceIsFolder && !inputFocus"
},
{
"key": "enter",
"command": "list.toggleExpand",
"when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && explorerResourceIsFolder && !inputFocus"
}
]
@tanishqmanuja
Copy link

The extension author recommends adding keymaps in settings.json (link), Are there any downsides using keybindings.json ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment