Last active
March 13, 2025 07:47
-
-
Save johtela/b63232747fdd465748fedb9ca6422c84 to your computer and use it in GitHub Desktop.
ModalEdit keybindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"modaledit.keybindings": { | |
"\n": [ | |
"lineBreakInsert", | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": { | |
"keys": "ku" | |
} | |
} | |
], | |
" ": "modaledit.enterInsert", | |
"Ö": "removeSecondaryCursors", | |
// Selection mode on/off | |
"s": "modaledit.toggleSelection", | |
"S": [ | |
{ | |
"command": "cursorMove", | |
"args": { | |
"to": "wrappedLineStart" | |
} | |
}, | |
"modaledit.toggleSelection", | |
"cursorDownSelect" | |
], | |
// Selection (visual) commands | |
"v": { | |
"id": 2, | |
"help": "Select [j|l] left|right, [w] word [d] line [f|b] forwards|backwards [i|a] inside|around", | |
"l": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "cursorRightSelect", | |
"repeat": "Number(__keys.slice(0, __keys.findIndex(isNaN)).join(''))" | |
} | |
], | |
"j": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "cursorLeftSelect", | |
"repeat": "Number(__keys.slice(0, __keys.findIndex(isNaN)).join(''))" | |
} | |
], | |
"w": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "cursorWordEndRightSelect", | |
"repeat": "Number(__keys.slice(0, __keys.findIndex(isNaN)).join(''))" | |
} | |
], | |
"b": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "cursorWordStartLeftSelect", | |
"repeat": "Number(__keys.slice(0, __keys.findIndex(isNaN)).join(''))" | |
} | |
], | |
"k": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "expandLineSelection", | |
"repeat": "Number(__keys.slice(0, __keys.findIndex(isNaN)).join(''))" | |
} | |
], | |
"t,T": { | |
"help": "Select forwards until _", | |
" -~": { | |
"command": "modaledit.selectBetween", | |
"args": "{ to: __rkeys[0], inclusive: __rkeys[1] == 'T' }" | |
} | |
}, | |
"u,U": { | |
"help": "Select backwards until _", | |
" -~": { | |
"command": "modaledit.selectBetween", | |
"args": "{ from: __rkeys[0], inclusive: __rkeys[1] == 'U' }" | |
} | |
}, | |
"a,i": { | |
"help": "Select around/inside _", | |
"w": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "modaledit.selectBetween", | |
"args": "{ from: '\\\\W', to: '\\\\W', regex: true, inclusive: __rkeys[1] == 'a' }" | |
} | |
], | |
" -/,:-@,[-`,{-~": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "modaledit.selectBetween", | |
"args": "{ from: __rkeys[0], to: __rkeys[0], inclusive: __rkeys[1] == 'a' }" | |
} | |
], | |
"(,)": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "modaledit.selectBetween", | |
"args": "{ from: '(', to: ')', inclusive: __rkeys[1] == 'a' }" | |
} | |
], | |
"{,}": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "modaledit.selectBetween", | |
"args": "{ from: '{', to: '}', inclusive: __rkeys[1] == 'a' }" | |
} | |
], | |
"[,]": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "modaledit.selectBetween", | |
"args": "{ from: '[', to: ']', inclusive: __rkeys[1] == 'a' }" | |
} | |
], | |
"<,>": [ | |
"modaledit.cancelSelection", | |
{ | |
"command": "modaledit.selectBetween", | |
"args": "{ from: '<', to: '>', inclusive: __rkeys[1] == 'a' }" | |
} | |
] | |
} | |
}, | |
// Delete/cut commands | |
"d": { | |
"id": 3, | |
"help": "Delete [j|l] left|right, [w] word [f|b] forwards|backwards [i|a] inside|around", | |
"d": "editor.action.clipboardCutAction", | |
"l,j,k,w,b": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: 'v' + __rkeys[0] }" | |
}, | |
"editor.action.clipboardCutAction" | |
], | |
"t,T,u,U": { | |
"help": "Delete until _", | |
" -~": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: ['v', ...__keys.slice(-2)].join('') }" | |
}, | |
"editor.action.clipboardCutAction" | |
] | |
}, | |
"a,i": { | |
"help": "Delete around/inside _", | |
"w, -/,:-@,[-`,{-~": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: ['v', ...__keys.slice(-2)].join('') }" | |
}, | |
"editor.action.clipboardCutAction" | |
] | |
} | |
}, | |
// Change commands | |
"c": { | |
"id": 4, | |
"help": "Change [j|l] left|right, [w] word [f|b] forwards|backwards [i|a] inside|around", | |
"c": [ | |
"deleteAllLeft", | |
"deleteAllRight", | |
"modaledit.enterInsert" | |
], | |
"l,j,k,w,b": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: 'd' + __rkeys[0] }" | |
}, | |
"modaledit.enterInsert" | |
], | |
"t,T,u,U": { | |
"help": "Change until _", | |
" -~": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: ['d', ...__keys.slice(-2)].join('') }" | |
}, | |
"modaledit.enterInsert" | |
] | |
}, | |
"a,i": { | |
"help": "Change around/inside _", | |
"w, -/,:-@,[-`,{-~": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: ['d', ...__keys.slice(-2)].join('') }" | |
}, | |
"modaledit.enterInsert" | |
] | |
} | |
}, | |
// Yank/copy commands | |
"y": { | |
"id": 5, | |
"help": "Delete [j|l] left|right, [w] word [f|b] forwards|backwards [i|a] inside|around", | |
"y": [ | |
"editor.action.clipboardCopyAction", | |
"modaledit.cancelSelection" | |
], | |
"l,j,k,w,b": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: 'v' + __rkeys[0] }" | |
}, | |
"editor.action.clipboardCopyAction", | |
"modaledit.cancelSelection" | |
], | |
"t,T,u,U": { | |
"help": "Delete until _", | |
" -~": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: ['v', ...__keys.slice(-2)].join('') }" | |
}, | |
"editor.action.clipboardCopyAction", | |
"modaledit.cancelSelection" | |
] | |
}, | |
"a,i": { | |
"help": "Delete around/inside _", | |
"w, -/,:-@,[-`,{-~": [ | |
{ | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: ['v', ...__keys.slice(-2)].join('') }" | |
}, | |
"editor.action.clipboardCopyAction", | |
"modaledit.cancelSelection" | |
] | |
} | |
}, | |
"f": [ | |
"deleteRight", | |
"modaledit.enterInsert" | |
], | |
"D": [ | |
"modaledit.cancelSelection", | |
"cursorEndSelect", | |
"editor.action.clipboardCutAction" | |
], | |
"F": [ | |
"deleteAllRight", | |
"modaledit.enterInsert" | |
], | |
"Y": [ | |
"modaledit.cancelSelection", | |
"cursorEndSelect", | |
"editor.action.clipboardCopyAction", | |
"modaledit.cancelSelection" | |
], | |
// Move up/down/left/right | |
"i": { | |
"command": "cursorMove", | |
"args": "{ to: 'up', select: __selecting }" | |
}, | |
"j": { | |
"command": "cursorMove", | |
"args": "{ to: 'left', select: __selecting }" | |
}, | |
"k": { | |
"command": "cursorMove", | |
"args": "{ to: 'down', select: __selecting }" | |
}, | |
"l": { | |
"command": "cursorMove", | |
"args": "{ to: 'right', select: __selecting }" | |
}, | |
"u": { | |
"command": "cursorMove", | |
"args": "{ to: 'wrappedLineStart', select: __selecting }" | |
}, | |
"o": { | |
"command": "cursorMove", | |
"args": "{ to: 'wrappedLineEnd', select: __selecting }" | |
}, | |
"U": { | |
"condition": "__selecting", | |
"true": "cursorTopSelect", | |
"false": "cursorTop" | |
}, | |
"O": { | |
"condition": "__selecting", | |
"true": "cursorBottomSelect", | |
"false": "cursorBottom" | |
}, | |
// Move to next/previous word | |
"w": { | |
"condition": "__selecting", | |
"true": "cursorWordStartRightSelect", | |
"false": "cursorWordStartRight" | |
}, | |
"b": { | |
"condition": "__selecting", | |
"true": "cursorWordStartLeftSelect", | |
"false": "cursorWordStartLeft" | |
}, | |
"W": { | |
"condition": "__selecting", | |
"false": { | |
"command": "cursorWordStartRight", | |
"repeat": "__char.match(/\\W/)" | |
}, | |
"true": { | |
"command": "cursorWordStartRightSelect", | |
"repeat": "__char.match(/\\W/)" | |
} | |
}, | |
"B": | |
{ | |
"condition": "__selecting", | |
"false": { | |
"command": "cursorWordStartLeft", | |
"repeat": "__char.match(/\\W/)" | |
}, | |
"true": { | |
"command": "cursorWordStartLeftSelect", | |
"repeat": "__char.match(/\\W/)" | |
} | |
}, | |
"p": { | |
"condition": "__selecting", | |
"true": "cursorWordPartRightSelect", | |
"false": "cursorWordPartRight" | |
}, | |
"P": { | |
"condition": "__selecting", | |
"true": "cursorWordPartLeftSelect", | |
"false": "cursorWordPartLeft" | |
}, | |
// Move to next previous page | |
"I": "cursorPageUp", | |
"K": "cursorPageDown", | |
// Move to next previous definition | |
"(": "gotoNextPreviousMember.previousMember", | |
")": "gotoNextPreviousMember.nextMember", | |
// Repeat movement commands | |
"1-9": { | |
"id": 1, | |
"help": "Enter count followed by [i,j,k,l,w,b,W,B,c,d,g]", | |
"0-9": 1, | |
"i,j,k,l,w,b,W,B": { | |
"command": "modaledit.typeNormalKeys", | |
"args": "{ keys: __rkeys[0] }", | |
"repeat": "Number(__keys.slice(0, -1).join(''))" | |
}, | |
"v": 2, | |
"d": 3, | |
"c": 4, | |
"y": 5, | |
"g": [ | |
{ | |
"command": "revealLine", | |
"args": "{ lineNumber: Number(__keys.slice(0, -1).join('')) - 1, at: 'top' }" | |
}, | |
{ | |
"command": "cursorMove", | |
"args": { | |
"to": "viewPortTop" | |
} | |
} | |
] | |
}, | |
// Scroll so that current line is in the center of the screen | |
"M": { | |
"command": "revealLine", | |
"args": "{ lineNumber: __line, at: 'center' }" | |
}, | |
// Expand/reduce selection smartly | |
"e": "editor.action.smartSelect.expand", | |
"r": "editor.action.smartSelect.shrink", | |
"E": { | |
"command": "modaledit.selectBetween", | |
"args": { | |
"from": "\\W", | |
"to": "\\W", | |
"regex": true | |
} | |
}, | |
// Repeat last change | |
".": "modaledit.repeatLastChange", | |
// Multiple selections | |
",": "editor.action.addSelectionToNextFindMatch", | |
";": "editor.action.addSelectionToPreviousFindMatch", | |
"-": "cursorUndo", | |
// Jump to matching bracket | |
"<": "editor.action.jumpToBracket", | |
// Undo/redo | |
"z": [ | |
"undo", | |
"modaledit.cancelSelection" | |
], | |
"Z": "redo", | |
// Copy/paste | |
"C": [ | |
"editor.action.clipboardCopyAction", | |
"modaledit.cancelSelection" | |
], | |
"X": [ | |
"editor.action.clipboardCutAction" | |
], | |
"V": "editor.action.clipboardPasteAction", | |
// Insert new line | |
"n": [ | |
"editor.action.insertLineAfter", | |
"modaledit.enterInsert" | |
], | |
"N": [ | |
"editor.action.insertLineBefore", | |
"modaledit.enterInsert" | |
], | |
// Append to the end of word/line | |
"a": [ | |
"modaledit.cancelSelection", | |
"modaledit.enterInsert" | |
], | |
"A": [ | |
"cursorEnd", | |
"modaledit.enterInsert" | |
], | |
// Join lines | |
"J": "editor.action.joinLines", | |
// Searching | |
"/": { | |
"command": "modaledit.search", | |
"args": { | |
"caseSensitive": true | |
} | |
}, | |
"?": { | |
"command": "modaledit.search", | |
"args": { | |
"backwards": true, | |
"caseSensitive": true | |
} | |
}, | |
"h": "modaledit.nextMatch", | |
"H": "modaledit.previousMatch", | |
"g": { | |
"command": "modaledit.search", | |
"args": { | |
"acceptAfter": 1, | |
"typeAfterAccept": "sj" | |
} | |
}, | |
"G": { | |
"command": "modaledit.search", | |
"args": { | |
"acceptAfter": 1, | |
"selectTillMatch": true | |
} | |
}, | |
// Bookmarks | |
"m": { | |
"help": "[1-4]: Go to mark, [d]: Define mark", | |
"d": { | |
"help": "Define mark [1-4]", | |
"1-4": { | |
"command": "modaledit.defineBookmark", | |
"args": "{ bookmark: Number(__rkeys[0]) }" | |
} | |
}, | |
"1-4": { | |
"command": "modaledit.goToBookmark", | |
"args": "{ bookmark: Number(__rkeys[0]) }" | |
} | |
}, | |
// Quick snippets | |
"q": { | |
"help": "[a]: Fill arguments, [w]: Define snippet, [1-4]: Enter snippet", | |
"a": "modaledit.fillSnippetArgs", | |
"w": { | |
"help": "Define snippet [1-4]", | |
"1-4": { | |
"command": "modaledit.defineQuickSnippet", | |
"args": "{ snippet: Number(__rkeys[0]) }" | |
} | |
}, | |
"1-4": [ | |
{ | |
"command": "modaledit.insertQuickSnippet", | |
"args": "{ snippet: Number(__rkeys[0]) }" | |
}, | |
"editor.action.formatDocument" | |
] | |
}, | |
// Misc Commands | |
":": "workbench.action.showCommands", | |
"ä": "breadcrumbs.focusAndSelect", | |
"'": { | |
"s": [ | |
"editor.action.clipboardCutAction", | |
"editor.action.smartSelect.expand", | |
"deleteRight", | |
"editor.action.clipboardPasteAction" | |
], | |
",": [ | |
"cursorEnd", | |
{ | |
"command": "editor.action.insertSnippet", | |
"args": { | |
"snippet": "," | |
} | |
} | |
] | |
}, | |
// Text transform and formatting | |
"t": { | |
"help": "Transform [u] upper [l] lower [t] title case. Format [f] selection [F] document", | |
"u": "editor.action.transformToUppercase", | |
"l": "editor.action.transformToLowercase", | |
"t": "editor.action.transformToTitlecase", | |
"f": "editor.action.formatSelection", | |
"F": "editor.action.formatDocument" | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment