Skip to content

Instantly share code, notes, and snippets.

@brandonto
Last active June 10, 2024 23:51
Show Gist options
  • Save brandonto/4c95d0e49582df162a7bf3788dd0c759 to your computer and use it in GitHub Desktop.
Save brandonto/4c95d0e49582df162a7bf3788dd0c759 to your computer and use it in GitHub Desktop.
VSCode Key Bindings for Vim navigation between Editor/Terminal/FileExplorer
[
// Vim navigation
//
{
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert' && !firstEditorInGroup"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusRightGroup",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
// Editor Focus
{
"key": "ctrl+k",
"command": "workbench.action.focusActiveEditorGroup",
"when": "!editorTextFocus"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusActiveEditorGroup",
"when": "focusedView == 'workbench.explorer.fileView'"
},
// File Explorer Focus
{
"key": "ctrl+h",
"command": "workbench.files.action.focusFilesExplorer",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert' && activeEditorGroupIndex === 1"
},
// Terminal Focus
{
"key": "ctrl+j",
"command": "workbench.action.terminal.focus",
"when": "terminalHasBeenCreated && !terminalFocus"
}
// ON MACOS ONLY:
//
// Remap renameFile to cmd+enter on macOS so opening a file with just enter works
{
"key": "cmd+enter",
"command": "renameFile",
"when": "explorerViewletVisible && filesExplorerFocus"
},
{
"key": "enter",
"command": "-renameFile",
"when": "explorerViewletVisible && filesExplorerFocus"
},
{
"key": "enter",
"command": "list.select",
"when": "listFocus && !inputFocus"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment