Skip to content

Instantly share code, notes, and snippets.

@babakks
Last active August 9, 2022 21:19
Show Gist options
  • Save babakks/cc30aeee2e2342ea22cd6b76f76f65b6 to your computer and use it in GitHub Desktop.
Save babakks/cc30aeee2e2342ea22cd6b76f76f65b6 to your computer and use it in GitHub Desktop.
vim-shortcuts-in-vscode
/*
* VIM SHORTCUTS IN VS CODE
*
* To enable basic Vim keyboard shortcuts in VS Code, prepend the following
* array to your `keybindings.json` file (run `Preferences: Open Keyboard
* Shortcuts (JSON)` in command palette). This preserves your existing shortcuts
* functional.
*
* The shortcuts include:
* - Text/list navigation (left/down/up/right): CTRL + CMD + h/j/k/l
* - Line beginning/end (home/end): CTRL + ALT + 0/4
* - Delete previous (backspace): CTRL + CMD + SPACE
* - Delete next (del): CTRL + CMD + SHIFT + SPACE
*
* (`CMD` key is the "Command" key on Mac, "Win" key on Windows, and "Meta" key
* on Sun devices.)
*
* It is possible to use the shortcuts with `SHIFT` and/or `ALT` key to activate
* selection mode, or move word-by-word. Also you can combine delete
* next/previous shortcuts with `ALT` to delete by word.
*
**/
[
{
"key": "ctrl+cmd+k",
"command": "history.showPrevious",
"when": "historyNavigationBackwardsEnabled && historyNavigationWidgetFocus && !suggestWidgetVisible"
},
{
"key": "ctrl+cmd+j",
"command": "history.showNext",
"when": " historyNavigationBackwardsEnabled && historyNavigationWidgetFocus && !suggestWidgetVisible"
},
{
"key": "ctrl+cmd+w l",
"command":"workbench.action.nextEditor"
},
{
"key": "ctrl+cmd+w ctrl+cmd+w",
"command":"workbench.action.nextEditor"
},
{
"key": "ctrl+cmd+w h",
"command":"workbench.action.previousEditor"
},
{
"key": "ctrl+cmd+shift+w ctrl+cmd+shift+w",
"command":"workbench.action.previousEditor"
},
{
"key": "ctrl+cmd+w j",
"command":"workbench.action.focusBelowGroup"
},
{
"key": "ctrl+cmd+w k",
"command":"workbench.action.focusAboveGroup"
},
{
"key": "ctrl+cmd+w l",
"command":"workbench.action.terminal.focusNext",
"when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus"
},
{
"key": "ctrl+cmd+w ctrl+cmd+w",
"command":"workbench.action.terminal.focusNext",
"when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus"
},
{
"key": "ctrl+cmd+w h",
"command":"workbench.action.terminal.focusPrevious",
"when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus"
},
{
"key": "ctrl+cmd+shift+w ctrl+cmd+shift+w",
"command":"workbench.action.terminal.focusPrevious",
"when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus"
},
{
"key": "ctrl+cmd+shift+g",
"command": "cursorBottom",
"when": "textInputFocus || editorFocus"
},
{
"key": "ctrl+cmd+g ctrl+cmd+g",
"command": "cursorTop",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+shift+space",
"command": "deleteRight"
},
{
"key": "cmd+ctrl+shift+alt+space",
"command": "deleteWordRight"
},
{
"key": "cmd+ctrl+space",
"command": "deleteLeft"
},
{
"key": "cmd+ctrl+alt+space",
"command": "deleteWordLeft"
},
{
"key": "cmd+ctrl+j",
"command": "cursorDown",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+j",
"command": "history.showNext",
"when": "historyNavigationEnabled && historyNavigationWidget"
},
{
"key": "cmd+ctrl+j",
"command": "keybindings.editor.focusKeybindings",
"when": "inKeybindings && inKeybindingsSearch"
},
{
"key": "cmd+ctrl+j",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+j",
"command": "notifications.focusNextToast",
"when": "notificationFocus && notificationToastsVisible"
},
{
"key": "cmd+ctrl+j",
"command": "outline.focusDownHighlighted",
"when": "outlineFiltered && outlineFocused"
},
{
"key": "cmd+ctrl+j",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "cmd+ctrl+j",
"command": "settings.action.focusSettingsFile",
"when": "inSettingsSearch && !suggestWidgetVisible"
},
{
"key": "cmd+ctrl+j",
"command": "settings.action.focusSettingsFromSearch",
"when": "inSettingsSearch && !suggestWidgetVisible"
},
{
"key": "cmd+ctrl+j",
"command": "showNextParameterHint",
"when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "cmd+ctrl+j",
"command": "workbench.action.interactivePlayground.arrowDown",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "cmd+ctrl+k",
"command": "cursorUp",
"when": "textInputFocus"
},
{
"key": "cmd+ctrl+k",
"command": "history.showPrevious",
"when": "historyNavigationEnabled && historyNavigationWidget"
},
{
"key": "cmd+ctrl+k",
"command": "list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+k",
"command": "notifications.focusPreviousToast",
"when": "notificationFocus && notificationToastsVisible"
},
{
"key": "cmd+ctrl+k",
"command": "outline.focusUpHighlighted",
"when": "outlineFiltered && outlineFocused"
},
{
"key": "cmd+ctrl+k",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "cmd+ctrl+k",
"command": "showPrevParameterHint",
"when": "editorTextFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "cmd+ctrl+k",
"command": "workbench.action.interactivePlayground.arrowUp",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "cmd+ctrl+h",
"command": "cursorLeft",
"when": "textInputFocus"
},
{
"key": "cmd+ctrl+h",
"command": "breadcrumbs.focusPrevious",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "cmd+ctrl+h",
"command": "list.collapse",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+h",
"command": "notification.collapse",
"when": "notificationFocus"
},
{
"key": "cmd+ctrl+l",
"command": "cursorRight",
"when": "textInputFocus"
},
{
"key": "cmd+ctrl+l",
"command": "breadcrumbs.focusNext",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "cmd+ctrl+l",
"command": "list.expand",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+l",
"command": "notification.expand",
"when": "notificationFocus"
},
{
"key": "cmd+ctrl+shift+h",
"command": "cursorLeftSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+shift+j",
"command": "cursorDownSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+shift+k",
"command": "cursorUpSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+shift+l",
"command": "cursorRightSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "ctrl+alt+0",
"command": "cursorHome",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "ctrl+alt+4",
"command": "cursorEnd",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "ctrl+alt+shift+0",
"command": "cursorHomeSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "ctrl+alt+shift+4",
"command": "cursorEndSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+alt+l",
"command": "cursorWordEndRight",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+alt+h",
"command": "cursorWordEndLeft",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+alt+shift+l",
"command": "cursorWordEndRightSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+alt+shift+h",
"command": "cursorWordEndLeftSelect",
"when": "editorTextFocus || textInputFocus || inputFocus || terminalFocus"
},
{
"key": "cmd+ctrl+f",
"command": "cursorPageDown",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+f",
"command": "list.focusPageDown",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+f",
"command": "selectNextPageSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "cmd+ctrl+f",
"command": "workbench.action.interactivePlayground.pageDown",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "cmd+ctrl+shift+f",
"command": "cursorPageDownSelect",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+d",
"command": "cursorPageDown",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+d",
"command": "list.focusPageDown",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+d",
"command": "workbench.action.interactivePlayground.pageDown",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "cmd+ctrl+d",
"command": "selectNextPageSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "cmd+ctrl+shift+d",
"command": "cursorPageDownSelect",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+b",
"command": "cursorPageUp",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+b",
"command": "list.focusPageUp",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+b",
"command": "selectPrevPageSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "cmd+ctrl+b",
"command": "workbench.action.interactivePlayground.pageUp",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "cmd+ctrl+shift+b",
"command": "cursorPageUpSelect",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+u",
"command": "cursorPageUp",
"when": "textInputFocus || editorFocus"
},
{
"key": "cmd+ctrl+u",
"command": "list.focusPageUp",
"when": "listFocus && !inputFocus"
},
{
"key": "cmd+ctrl+u",
"command": "selectPrevPageSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "cmd+ctrl+u",
"command": "workbench.action.interactivePlayground.pageUp",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "cmd+ctrl+shift+u",
"command": "cursorPageUpSelect",
"when": "textInputFocus || editorFocus"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment