Skip to content

Instantly share code, notes, and snippets.

@AlexArus
Last active April 27, 2023 14:00
Show Gist options
  • Save AlexArus/f72ae4a664967d53927fa0d7176e74d5 to your computer and use it in GitHub Desktop.
Save AlexArus/f72ae4a664967d53927fa0d7176e74d5 to your computer and use it in GitHub Desktop.
Useful keybindings for Visual Studio Code (keybindings.json) and micro (bindings.json from ~/.config/micro/bindings.json)
/**
* Useful keybindings for micro
* version: 19.12.11
* author: Alex Arus
*
* to install put it to ~/.config/micro/bindings.json
* +------------------------------------------------------------+
* | Y | U | I | O | P |
* | add cursor above| home | up | end | page up |
* |-----------------|---------|---------|---------|------------|
* Alt + | H | J | K | L | : |
* | add cursor below| left | down | right | page down |
* |-----------------|---------|---------|---------|------------|
* | N | M | < | > | ? |
* | escape | enter | tab | delete | backspace |
* +------------------------------------------------------------+
*/
{
"Alt-j": "CursorLeft",
"Alt-l": "CursorRight",
"Alt-i": "CursorUp",
"Alt-k": "CursorDown",
"Alt-u": "StartOfLine",
"Alt-o": "EndOfLine",
"Alt-p": "CursorPageUp",
"Alt-;": "CursorPageDown",
"Alt-m": "InsertNewline",
"Alt-,": "IndentSelection,InsertTab",
"Alt-.": "Delete",
"Alt-/": "Backspace",
"Alt-y": "RemoveMultiCursor",
"Alt-h": "SpawnMultiCursor",
"Alt-n": "Escape",
}
/**
* Useful keybindings for Visual Studio Code
* version: 27.04.23
* author: Alex Arus
* url: https://gist.github.com/AlexArus/f72ae4a664967d53927fa0d7176e74d5
*
* +---------------------------------------------------------+
* | Y add cursor | U | I | O | P |
* | above | home | up | end | page up |
* |--------------|---------|---------|---------|------------|
* Alt + | H add cursor | J | K | L | : |
* | below | left | down | right | page down |
* |--------------|---------|---------|---------|------------|
* | N | M | < | > | ? |
* | escape | enter | tab | delete | backspace |
* +---------------------------------------------------------+
*
*
* +------------------------------+
* | U file | I scroll | O file |
* | begin | up | end |
* |---------|----------|---------|
* Alt + Ctrl + | J word | K scroll | L word |
* | left | down | right |
* +------------------------------+
*
*
* + Shift = add selection
*
*
* +-------------------------------------------+
* | | W | E | R console |
* | | split | explorer | log |
* |---------|---------|-----------|-----------|
* Alt + | A prev | S next | D prev | F next |
* | group | group | editor | editor |
* +-------------------------------------------+
*
*
* Alt + r - type text in when editor in focus // eslint-disable-next-line\nconsole.log()
*
* Alt + w - split vertically or default split
* Alt + Shift + w - split horizontally
*
* Alt + e - focus explorer panel (fix linux gnome issue with ctrl+shift+e)
*
* Alt + Ctrl + f - move editor into next group
* Alt + Ctrl + d - move editor into previous group
*
* F10 - run task
*
*/
[
// layout-independent shortcuts
{
"key": "ctrl+[Slash]",
"command": "editor.action.commentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+[Backquote]",
"command": "workbench.action.terminal.toggleTerminal",
"when": "terminal.active"
},
// CHANGE EDITOR SIZE
{
"key": "alt+[Minus]",
"command": "workbench.action.decreaseViewSize",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[Minus]",
"command": "workbench.action.decreaseViewHeight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[Minus]",
"command": "workbench.action.decreaseViewWidth",
"when": "editorTextFocus"
},
{
"key": "alt+[Equal]",
"command": "workbench.action.increaseViewSize",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[Equal]",
"command": "workbench.action.increaseViewHeight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[Equal]",
"command": "workbench.action.increaseViewWidth",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyT]",
"command": "workbench.action.tasks.runTask"
},
// CURSOR MOVE & TEXT EDITOR HELPERS
{
"key": "alt+[KeyU]",
"command": "cursorHome",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyI]",
"command": "cursorUp",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyO]",
"command": "cursorEnd",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyP]",
"command": "cursorPageUp",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyJ]",
"command": "cursorLeft",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyK]",
"command": "cursorDown",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyL]",
"command": "cursorRight",
"when": "editorTextFocus"
},
{
"key": "alt+[Semicolon]",
"command": "cursorPageDown",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyM]",
"command": "type",
"args": {
"text": "\n"
},
"when": "editorTextFocus"
},
{
"key": "alt+[Comma]",
"command": "tab",
"when": "editorTextFocus"
},
{
"key": "alt+[Period]",
"command": "deleteRight",
"when": "editorTextFocus"
},
{
"key": "alt+[Slash]",
"command": "deleteLeft",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyU]",
"command": "cursorTop",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyI]",
"command": "scrollLineUp",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyO]",
"command": "cursorBottom",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyJ]",
"command": "cursorWordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyK]",
"command": "scrollLineDown",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyL]",
"command": "cursorWordRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyU]",
"command": "cursorHomeSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyI]",
"command": "cursorUpSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyO]",
"command": "cursorEndSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyP]",
"command": "cursorPageUpSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyJ]",
"command": "cursorLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyK]",
"command": "cursorDownSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyL]",
"command": "cursorRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[Semicolon]",
"command": "cursorPageDownSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+ctrl+[KeyU]",
"command": "cursorTopSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+ctrl+[KeyO]",
"command": "cursorBottomSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+ctrl+[KeyJ]",
"command": "cursorWordLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+ctrl+[KeyL]",
"command": "cursorWordRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyW]",
"command": "workbench.action.splitEditorRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+[KeyW]",
"command": "workbench.action.splitEditorDown",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyW]",
"command": "workbench.action.terminal.split",
"when": "terminalFocus"
},
{
"key": "alt+[KeyR]",
"command": "type",
"args": {
"text": "// eslint-disable-next-line\nconsole.log()"
},
"when": "editorTextFocus"
},
{
"key": "alt+[KeyI]",
"command": "history.showPrevious",
"when": "historyNavigationEnabled && historyNavigationWidget"
},
{
"key": "alt+[KeyI]",
"command": "list.focusUp",
"when": "listFocus && !inputFocus"
},
{
"key": "alt+[KeyI]",
"command": "notifications.focusPreviousToast",
"when": "notificationFocus && notificationToastsVisible"
},
{
"key": "alt+[KeyI]",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "alt+[KeyI]",
"command": "showPrevParameterHint",
"when": "editorFocus && parameterHintsMultipleSignature && parameterHintsVisible"
},
{
"key": "alt+[KeyI]",
"command": "workbench.action.interactivePlayground.arrowUp",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "alt+[KeyJ]",
"command": "breadcrumbs.focusPrevious",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "alt+[KeyJ]",
"command": "list.collapse",
"when": "listFocus && !inputFocus"
},
{
"key": "alt+[KeyJ]",
"command": "notification.collapse",
"when": "notificationFocus"
},
{
"key": "alt+[KeyK]",
"command": "breadcrumbs.selectFocused",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "alt+[KeyK]",
"command": "history.showNext",
"when": "historyNavigationEnabled && historyNavigationWidget"
},
{
"key": "alt+[KeyK]",
"command": "keybindings.editor.focusKeybindings",
"when": "inKeybindings && inKeybindingsSearch"
},
{
"key": "alt+[KeyK]",
"command": "list.focusDown",
"when": "listFocus && !inputFocus"
},
{
"key": "alt+[KeyK]",
"command": "notifications.focusNextToast",
"when": "notificationFocus && notificationToastsVisible"
},
{
"key": "alt+[KeyK]",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "alt+[KeyK]",
"command": "settings.action.focusSettingsFile",
"when": "inSettingsSearch && !suggestWidgetVisible"
},
{
"key": "alt+[KeyK]",
"command": "settings.action.focusSettingsFromSearch",
"when": "inSettingsSearch && !suggestWidgetVisible"
},
{
"key": "alt+[KeyK]",
"command": "showNextParameterHint",
"when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "alt+[KeyK]",
"command": "workbench.action.interactivePlayground.arrowDown",
"when": "interactivePlaygroundFocus && !editorTextFocus"
},
{
"key": "alt+[KeyL]",
"command": "breadcrumbs.focusNext",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "alt+[KeyL]",
"command": "list.expand",
"when": "listFocus && !inputFocus"
},
{
"key": "alt+[KeyL]",
"command": "notification.expand",
"when": "notificationFocus"
},
{
"key": "alt+[KeyY]",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyH]",
"command": "editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyN]",
"command": "closeFindWidget",
"when": "editorFocus && parameterHintsVisible"
},
{
"key": "alt+[KeyN]",
"command": "closeMarkersNavigation",
"when": "editorFocus && markersNavigationVisible"
},
{
"key": "alt+[KeyN]",
"command": "closeParameterHints",
"when": "editorFocus && parameterHintsVisible"
},
{
"key": "alt+[KeyN]",
"command": "editor.cancelOperation",
"when": "cancellableOperation"
},
{
"key": "alt+[KeyN]",
"command": "editor.gotoNextSymbolFromResult.cancel",
"when": "hasSymbol"
},
{
"key": "alt+[KeyN]",
"command": "hideSuggestWidget",
"when": "suggestWidgetVisible && textInputFocus"
},
{
"key": "alt+[KeyN]",
"command": "removeSecondaryCursors",
"when": "editorHasMultipleSelections && textInputFocus"
},
{
"key": "alt+[KeyE]",
"command": "workbench.view.explorer"
},
{
"key": "ctrl+shift+[KeyE]",
"command": "-workbench.view.explorer"
},
{
"key": "alt+[KeyF]",
"command": "workbench.action.nextEditor",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyD]",
"command": "workbench.action.previousEditor",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyS]",
"command": "workbench.action.focusNextGroup",
"when": "editorTextFocus"
},
{
"key": "alt+[KeyA]",
"command": "workbench.action.focusPreviousGroup",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyF]",
"command": "workbench.action.moveEditorToNextGroup",
"when": "editorTextFocus"
},
{
"key": "alt+ctrl+[KeyD]",
"command": "workbench.action.moveEditorToPreviousGroup",
"when": "editorTextFocus"
},
{
"key": "f10",
"command": "workbench.action.tasks.runTask"
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment