Skip to content

Instantly share code, notes, and snippets.

@haberdashPI
Created September 22, 2020 13:21
Show Gist options
  • Save haberdashPI/89d4bd274dedd49d87add35ac75c0ad3 to your computer and use it in GitHub Desktop.
Save haberdashPI/89d4bd274dedd49d87add35ac75c0ad3 to your computer and use it in GitHub Desktop.
{
"keybindings": {
///////////////////////////////////
// Basic selection operators, reset or extend selection
// 'entire' movements (select entire object, not just from start point)
"u": {
// word-like movement
"w": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "subword", "boundary": "both", "selectWhole": true }
},
"W": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "word", "boundary": "both", "selectWhole": true }
},
"b": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "subword", "boundary": "both", "value": -1, "selectWhole": true }
},
"B": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "word", "boundary": "both", "value": -1, "selectWhole": true }
},
// motions
"g": {
"w": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "WORD", "boundary": "both", "selectWhole": true }
},
"b": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "WORD", "boundary": "both", "selectWhole": true, "value": -1 }
},
"p": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "section", "boundary": "start", "selectWhole": true }
},
"P": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "section", "boundary": "start", "selectWhole": true, "value": -1 }
},
"s": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "subsection", "boundary": "start", "selectWhole": true }
},
"S": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "subsection", "boundary": "start", "selectWhole": true, "value": -1 }
},
},
// paragraph-like
"p": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "paragraph", "boundary": "both", "selectWhole": true }
},
"P": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "paragraph", "value": -1, "boundary": "both", "selectWhole": true }
},
// function arguments
"s": {
// motions
"w": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": 1, "boundary": "both", "selectWhole": true }
},
"b": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": -1, "boundary": "both", "selectWhole": true }
},
"W": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": 1, "boundary": "start", "selectWhole": true }
},
"B": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": -1, "boundary": "end", "selectWhole": true }
},
},
},
// basic movement
"h": { "command": "cursorMove", "args": "{ to: 'left', select: __selecting }" },
"j": { "command": "cursorMove", "args": "{ to: 'down', by: 'wrappedLine', select: __selecting }" },
"k": { "command": "cursorMove", "args": "{ to: 'up', by: 'wrappedLine', select: __selecting }" },
"l": { "command": "cursorMove", "args": "{ to: 'right', select: __selecting }" },
// word-like movement
"w": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'subword', boundary: 'start', select: true }"
},
"W": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'word', boundary: 'start', select: true }"
},
"e": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'word', boundary: 'end', select: true }"
},
"b": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'subword', boundary: 'start', value: -1, select: true }"
},
"B": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'word', boundary: 'start', value: -1, select: true }"
},
"E": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'word', boundary: 'end', value: -1, select: true }"
},
// numbers
"@": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ value: -1, unit: 'integer', boundary: 'both', selectWhole: true }"
},
"#": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ unit: 'integer', boundary: 'both', selectWhole: true }"
},
///////////////////////
// line related operators
"H": "cursorHomeSelect",
"L": {
"command": "cursorMove",
"args": "{ to: 'wrappedLineEnd', select: true }"
},
"G": [
"expandLineSelection",
],
"K": {
"condition": "editor.selection.isSingleLine",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: false }"
},
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'wrappedLine', select: true, value: 2 }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'wrappedLine', select: true }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
},
// TODO: handle last line of document specially
"J": {
"condition": "editor.selection.isSingleLine",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: false }"
},
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true, value: 2 }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
},
// paragraph related
"p": [
{
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "paragraph", "boundary": "start", "select": true }
}
],
"P": [
{
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "paragraph", "value": -1, "boundary": "start", "select": true }
}
],
// // page movement
// "J": [
// {
// "command": "editorScroll",
// "args": "{ to: 'down', by: 'halfPage' }"
// },
// {
// "command": "cursorMove",
// "args": "{ to: 'viewPortBottom', select: __selecting }"
// },
// ],
// "K": [
// {
// "command": "editorScroll",
// "args": "{ to: 'up', by: 'halfPage' }"
// },
// {
// "command": "cursorMove",
// "args": "{ to: 'viewPortTop', select: __selecting }"
// },
// ],
// buffer related
"$": [ "editor.action.selectAll" ],
// search related
"/": [ "actions.find"
],
"*": [
"actions.find",
"editor.action.nextMatchFindAction",
"closeFindWidget"
],
"&": [
"actions.find",
"editor.action.previousMatchFindAction",
"closeFindWidget"
],
"n": [
"editor.action.nextMatchFindAction"
],
"N": [
"editor.action.previousMatchFindAction"
],
"?": [
{
"command": "modaledit.search",
"args": {
"caseSensitive": true,
"backwards": false,
"selectTillMatch": true,
"wrapAround": true
}
},
],
"f": [
{
"command": "modaledit.search",
"args": {
"caseSensitive": true,
"acceptAfter": 1,
"backwards": false,
"selectTillMatch": true,
"wrapAround": true
}
},
],
"F": [
{
"command": "modaledit.search",
"args": {
"caseSensitive": true,
"acceptAfter": 1,
"backwards": true,
"selectTillMatch": true,
"wrapAround": true
}
},
],
"t": [
{
"command": "modaledit.search",
"args": {
"caseSensitive": true,
"acceptAfter": 1,
"backwards": false,
"selectTillMatch": true,
"typeAfterAccept": "h",
"typeBeforeNextMatch": "l",
"typeAfterNextMatch": "h",
"typeBeforePreviousMatch": "h",
"typeAfterPreviousMatch": "l",
"wrapAround": true
}
},
],
"T": [
{
"command": "modaledit.search",
"args": {
"caseSensitive": true,
"acceptAfter": 1,
"backwards": true,
"selectTillMatch": true,
"typeAfterAccept": "l",
"typeBeforeNextMatch": "h",
"typeAfterNextMatch": "l",
"typeBeforePreviousMatch": "l",
"typeAfterPreviousMatch": "h",
"wrapAround": true
}
},
],
"m": [
{
"command": "modaledit.search",
"args": {
"caseSensitive": true,
"acceptAfter": 2,
"backwards": false,
"selectTillMatch": true,
"typeAfterAccept": "hh",
"typeBeforeNextMatch": "ll",
"typeAfterNextMatch": "hh",
"wrapAround": true
}
},
],
"M": [
{
"command": "modaledit.search",
"args": {
"casSensitive": true,
"acceptAfter": 2,
"backwards": true,
"selectTillMatch": true,
"typeBeforePreviousMatch": "ll",
"typeAfterPreviousMatch": "hh",
"wrapAround": true
}
},
],
";": [
"modaledit.nextMatch",
],
",": [
"modaledit.previousMatch",
],
////////////////////////
// more complex syntactic selections
// "I": "select-indentation.expand-selection",
"%": "editor.action.jumpToBracket",
"'": "extension.selectSingleQuote",
"\"": "extension.selectDoubleQuote",
// the below is a bit hacky; I want to add these commandsto my extension
"[": [
{
"condition": "!editor.selection.isEmpty",
"true": [
"selection-utilities.active-at-start",
{ "command": "cursorMove", "args": { "to": "left", "select": true, "value": 2 } },
"selection-utilities.active-at-end",
{ "command": "cursorMove", "args": { "to": "right", "select": true, "value": 2 } }
],
"false": []
},
{
"command": "editor.action.selectToBracket",
"args": {"selectBrackets": false}
}
],
"{": [
{
"condition": "!editor.selection.isEmpty",
"true": [
"selection-utilities.active-at-start",
{ "command": "cursorMove", "args": { "to": "left", "select": true } },
"selection-utilities.active-at-end",
{ "command": "cursorMove", "args": { "to": "right", "select": true } }
],
},
{
"command": "editor.action.selectToBracket",
"args": {"selectBrackets": true}
}
],
"`": "extension.selectBackTick",
"]": "vscode-select-by-indent.select-inner",
"}": "vscode-select-by-indent.select-outer",
////////////////////////
// selection modifiers
"R": [ "selection-utilities.trim-selection-whitespace" ],
"U": [
{
"command": "vscode-custom-word-motions.narrowto",
"args": {
"unit": "subident",
"boundary": "both",
}
}
],
"x": [ "selection-utilities.add-next" ],
"X": [ "selection-utilities.skip-next" ],
"r": [ "modaledit.cancelMultipleSelections" ],
" ": [ "modaledit.enableSelection", ],
////////////////////////
// actions
// insert/append text
"i": [
{
"condition": "editor.selection.isEmpty",
"true": "modaledit.enterInsert",
"false": [
{
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
"modaledit.enterInsert"
]
},
],
"a": [
{
"condition": "editor.selection.isEmpty",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'right', select: false }"
},
"modaledit.enterInsert"
],
"false": [
"selection-utilities.exchange-anchor-active",
{
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
"modaledit.enterInsert"
]
},
],
"I": [
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineFirstNonWhitespaceCharacter', select: false }"
},
"modaledit.enterInsert",
],
"A": [
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineEnd', select: false }"
},
"modaledit.enterInsert",
],
// change
"c": [
{
"condition": "!editor.selection.isSingleLine && editor.selection.end.character == 0 && editor.selection.start.character == 0",
"false": [
"deleteRight",
"modaledit.enterInsert"
],
"true": [
"deleteRight",
"editor.action.insertLineBefore",
"modaledit.enterInsert"
]
},
],
"C": [
"modaledit.cancelMultipleSelections",
"deleteAllRight",
"modaledit.enterInsert",
],
// update numerical selection
"+": [
{
"condition": "editor.selections.length === 1",
"true": "editor.emmet.action.incrementNumberByOne",
"false": "extension.incrementSelection",
},
],
"=": [
{
"condition": "editor.selections.length === 1",
"true": "editor.emmet.action.decrementNumberByOne",
"false": "extension.decrementSelection",
},
],
// check
"^": "markdown-checkbox.markCheckbox",
// cut to clipboard
"d": [
"editor.action.clipboardCutAction",
],
"D": [
"modaledit.cancelMultipleSelections",
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineEnd', select: true }"
},
"editor.action.clipboardCutAction",
],
"\\": [
{
"condition": "editor.selection.isEmpty",
"true": [],
"false": ["modaledit.cancelMultipleSelections"],
},
{
"command": "cursorMove",
"args": "{ to: 'right', select: true }"
},
"editor.action.clipboardCutAction",
],
// copy to clipboard
"y": [
"editor.action.clipboardCopyAction",
{
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
],
"Y": [
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineEnd', select: true }"
},
"editor.action.clipboardCopyAction",
"modaledit.cancelMultipleSelections"
],
// paste after
"v": [
{ "condition": "!editor.selection.isEmpty",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": "cursorRight"
},
"editor.action.clipboardPasteAction",
],
// paste before
"V": [
{
"condition": "!editor.selection.isEmpty",
"true": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
},
"false": []
},
"editor.action.clipboardPasteAction",
],
// begin line below
"o": [
{
"condition": "editor.selection.isEmpty",
"true": "editor.action.insertLineAfter",
"false": {
"condition": "!editor.selection.isReversed",
"true": "editor.action.insertLineBefore",
"false": [
"selection-utilities.exchange-anchor-active",
"editor.action.insertLineBefore",
]
}
},
"modaledit.enterInsert",
],
"O": [
{
"condition": "editor.selection.isEmpty",
"true": "editor.action.insertLineBefore",
"false": {
"condition": "editor.selection.isReversed",
"true": "editor.action.insertLineBefore",
"false": [
"selection-utilities.exchange-anchor-active",
"editor.action.insertLineBefore",
]
}
},
"modaledit.enterInsert",
],
// line indent
">": [
"editor.action.indentLines",
],
"<": [
"editor.action.outdentLines",
],
":": "workbench.action.quickOpen",
///////////////////////
// history
"z": [
"undo",
{
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
],
"Z": [
"redo",
{
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
],
"-": "cursorUndo",
"_": "cursorRedo",
"q": [
],
"Q": [
{
"command": "modaledit.replayRecordedKeys",
"args": "{ register: 'default' }"
},
],
// ".": {
// "command": "modaledit.replayRecordedKeys",
// "args": "{ register: 'repeat' }"
// },
".": [
"modaledit.repeatLastSelection",
"modaledit.repeatLastChange",
],
// first leader
"g": {
".": "modaledit.repeatLastChange",
// motions
"w": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "WORD", "boundary": "start", "select": true }
},
"b": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "WORD", "boundary": "start", "select": true, "value": -1 }
},
"W": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "WORD", "boundary": "end", "select": true, "value": 1 }
},
"B": {
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "WORD", "boundary": "end", "select": true, "value": -1 }
},
"x": [ "selection-utilities.add-prev" ],
"X": [ "selection-utilities.skip-prev" ],
// actions
"r": [
"git.stageSelectedRanges",
// "modaledit.touchText"
],
"R": [
"git.unstageSelectedRanges",
// "modaledit.touchText"
],
"V": [
"editor.action.clipboardPasteAction",
],
"v": [
"clipboard-manager.editor.pickAndPaste",
],
"a": [ "selection-utilities.trim-whitespace" ],
"o": [
{
"condition": "editor.selection.isEmpty",
"true": "editor.action.insertLineAfter",
"false": {
"condition": "!editor.selection.isReversed",
"true": "editor.action.insertLineBefore",
"false": [
"selection-utilities.exchange-anchor-active",
"editor.action.insertLineBefore",
]
}
},
],
"O": [
{
"condition": "editor.selection.isEmpty",
"true": "editor.action.insertLineBefore",
"false": {
"condition": "editor.selection.isReversed",
"true": "editor.action.insertLineBefore",
"false": [
"selection-utilities.exchange-anchor-active",
"editor.action.insertLineBefore",
]
}
},
],
";": [
"editor.action.commentLine",
{
"condition": "!editor.selection.isEmpty",
"true": {
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
"false": []
},
],
":": [
"editor.action.blockComment",
{
"condition": "!editor.selection.isEmpty",
"true": {
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
"false": []
},
],
"/": [
"comment-divider.makeSubHeader",
{
"condition": "!editor.selection.isEmpty",
"true": {
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
"false": []
},
],
"l": [
"terminal-polyglot.send-text",
// "modaledit.touchText",
"modaledit.cancelMultipleSelections",
],
"L": [
"terminal-polyglot.send-block-text",
// "modaledit.touchText",
"modaledit.cancelMultipleSelections",
],
"q": [
"rewrap.rewrapComment",
],
"y": [
"editor.action.joinLines",
],
// view changes
"c": {
"command": "revealLine",
"args": "{ lineNumber: __line, at: 'center' }"
},
"t": {
"command": "revealLine",
"args": "{ lineNumber: __line, at: 'top' }"
},
"T": {
"command": "revealLine",
"args": "{ lineNumber: __line, at: 'bottom' }"
},
"h": [
"editor.action.showHover",
],
// motions
"p": [
{
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "section", "boundary": "start", "select": true }
},
],
"P": [
{
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "section", "boundary": "start", "select": true, "value": -1 }
},
],
"s": [
{
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "subsection", "boundary": "start", "select": true }
},
],
"S": [
{
"command": "vscode-custom-word-motions.moveby",
"args": { "unit": "subsection", "boundary": "start", "select": true, "value": -1 }
},
],
"j": "cursorBottomSelect",
"k": "cursorTopSelect",
">": [
"extension.selectAngleBrackets",
],
"<": [
"extension.selectInTag",
],
"]": [
"vscode-select-by-indent.select-outer-top-only",
],
"{": [ "bracketeer.removeBrackets", ],
"[": [ "bracketeer.swapBrackets", ],
"'": [ "bracketeer.swapQuotes", ],
"\"": [ "bracketeer.removeQuotes", ],
"e": [ "editor.action.marker.next", ],
"E": [ "editor.action.marker.prev", ],
"d": [ "editor.action.dirtydiff.next", ],
"D": [ "editor.action.dirtydiff.previous", ],
"f": [ "workbench.action.editor.nextChange", ],
"F": [ "workbench.action.editor.previousChange", ],
"g": [ "editor.action.revealDefinition", ],
"G": [ "editor.action.revealDefinitionAside", ],
"n": [
{
"command": "modaledit.defineBookmark",
"args": "{ bookmark: 'default' }"
},
],
"m": [
{
"command": "modaledit.goToBookmark",
"args": "{ bookmark: 'default' }"
},
]
},
// second leader
"s": {
// actions
"(": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "(" },
},
"modaledit.enterNormal"
],
"<": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "<" },
},
"modaledit.enterNormal"
],
"`": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "`" },
},
"modaledit.enterNormal"
],
"\"": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "\"" },
},
"modaledit.enterNormal"
],
"'": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "'" },
},
"modaledit.enterNormal"
],
"*": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "*" },
},
"modaledit.enterNormal"
],
"2": {
"*": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "**" },
},
"modaledit.enterNormal"
],
},
"{": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "{" },
},
"modaledit.enterNormal"
],
"[": [
"modaledit.enterInsert",
{
"command": "type",
"args": { "text": "[" },
},
"modaledit.enterNormal"
],
"=": "selection-utilities.align-selections-left",
"+": "selection-utilities.align-selections-right",
// histoory
".": "modaledit.repeatLastSelection",
// selection modifiers
"h": "selection-utilities.active-at-start",
"l": "selection-utilities.active-at-end",
"j": "selection-utilities.move-primary-right",
"k": "selection-utilities.move-primary-left",
"c": "selection-utilities.append-to-memory",
"v": "selection-utilities.restore-and-clear",
"x": "selection-utilities.swap-with-memory",
"n": "selection-utilities.delete-last-saved",
"d": "selection-utilities.delete-primary",
"s": "selection-utilities.split-by-newline",
"S": "selection-utilities.split-by",
"g": "selection-utilities.create-by",
"G": "selection-utilities.create-by-regex",
"r": "selection-utilities.split-by-regex",
"f": "selection-utilities.include-by",
"F": "selection-utilities.exclude-by",
"t": "selection-utilities.include-by-regex",
"T": "selection-utilities.exclude-by-regex",
"-": {
"command": "selection-utilities.restore-and-clear",
"args": {"register": "cancel"}
},
// motions
"w": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": 1, "boundary": "start", "select": true }
},
"b": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": -1, "boundary": "start", "select": true }
},
"W": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": 1, "boundary": "start", "select": true }
},
"B": {
"command": "move-cursor-by-argument.move-by-argument",
"args": { "value": -1, "boundary": "end", "select": true }
},
},
"0": {
// cut to clipboard
"d": [
{
"condition": "!editor.selection.isEmpty",
"true": [
"deleteRight",
],
"false": [
"editor.action.deleteLines",
]
}
],
"D": [
{
"condition": "!editor.selection.isEmpty",
"true": {
"condition": "!editor.selection.isReversed",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: 0 }"
},
"false": {
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: 0 }"
}
},
"false": []
},
"deleteAllRight",
],
"]": [
{
"condition": "editor.selection.isEmpty",
"true": "deleteRight",
"false": "editor.action.clipboardCutAction"
},
],
},
"1-9": {
"id": 1,
"help": "Enter count followed by movement",
"0-9": 1,
"p,P,=,+": {
"command": "modaledit.typeNormalKeys",
"args": "{ keys: __keys[__keys.length - 1] }",
"repeat": "Number(__keys.slice(0, -1).join(''))"
},
// word-like
"w": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ 'unit': 'subword', 'boundary': 'start', 'select': true, 'value': Number(__keys.slice(0, -1).join('')) }"
},
"W": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ 'unit': 'word', 'boundary': 'start', 'select': true, 'value': Number(__keys.slice(0, -1).join('')) }"
},
"e": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ 'unit': 'word', 'boundary': 'end', 'select': true, 'value': Number(__keys.slice(0, -1).join('')) }"
},
"b": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ 'unit': 'subword', 'boundary': 'start', 'value': -Number(__keys.slice(0, -1).join('')), select: true }"
},
"B": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ 'unit': 'word', 'boundary': 'start', 'value': -Number(__keys.slice(0, -1).join('')), select: true }"
},
"E": {
"command": "vscode-custom-word-motions.moveby",
"args": "{ 'unit': 'word', 'boundary': 'end', 'value': -Number(__keys.slice(0, -1).join('')), select: true }"
},
// special jump commands
"g": {
"e,E,f,F": {
"command": "modaledit.typeNormalKeys",
"args": "{ keys: __keys[__keys.length - 2] }",
"repeat": "Number(__keys.slice(0, -2).join(''))"
},
"n": [
{
"command": "modaledit.defineBookmark",
"args": "{ bookmark: Number(__keys.slice(0, -2).join('')) }"
},
],
"m": [
{
"command": "modaledit.goToBookmark",
"args": "{ bookmark: Number(__keys.slice(0, -2).join('')) }"
},
],
// jump down given number of full lines (not wrapped)
"j": [
{
"condition": "!__selecting",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'line', select: false, value: Number(__keys.slice(0, -2).join('')) }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'line', select: true, value: Number(__keys.slice(0, -2).join('')) }"
},
]
},
],
"k":[
{
"condition": "!__selecting",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'line', select: false, value: Number(__keys.slice(0, -2).join('')) }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'line', select: true, value: Number(__keys.slice(0, -2).join('')) }"
},
]
},
],
},
"q": [
],
"Q": [
{
"command": "modaledit.replayRecordedKeys",
"args": "{ register: __keys.slice(0, -1).join('') }"
},
],
"h": [
{
"condition": "!__selecting",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'left', select: false, value: Number(__keys.slice(0, -1).join('')) }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'left', select: true, value: Number(__keys.slice(0, -1).join('')) }"
},
]
},
],
"j": [
{
"condition": "!__selecting",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: false, value: Number(__keys.slice(0, -1).join('')) }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true, value: Number(__keys.slice(0, -1).join('')) }"
},
]
},
],
"k":[
{
"condition": "!__selecting",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'wrappedLine', select: false, value: Number(__keys.slice(0, -1).join('')) }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'wrappedLine', select: true, value: Number(__keys.slice(0, -1).join('')) }"
},
]
},
],
"l":[
{
"condition": "!__selecting",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'right', select: false, value: Number(__keys.slice(0, -1).join('')) }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'right', select: true, value: Number(__keys.slice(0, -1).join('')) }"
},
]
},
],
"K": [
{
"condition": "editor.selection.isSingleLine",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: false }"
},
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'wrappedLine', select: true, value: Number(__keys.slice(0, -1).join(''))+1 }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'up', by: 'wrappedLine', select: true, value: Number(__keys.slice(0, -1).join('')) }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
},
],
// TODO: handle last line of document specially
"J": [
{
"condition": "editor.selection.isSingleLine",
"true": [
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: false }"
},
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true, value: Number(__keys.slice(0, -1).join(''))+1 }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
"false": [
{
"command": "cursorMove",
"args": "{ to: 'down', by: 'wrappedLine', select: true, value: Number(__keys.slice(0, -1).join('')) }"
},
{
"command": "cursorMove",
"args": "{ to: 'wrappedLineStart', select: true }"
},
],
},
],
// multi-line actions
"d": [
"modaledit.cancelMultipleSelections",
{
"command": "cursorMove",
"args": {"to": "wrappedLineStart", "select": false}
},
{
"command": "cursorMove",
"args": "{ to: 'down', select: true, value: Number(__keys.slice(0, -1).join(''))+1 }"
},
"editor.action.clipboardCutAction",
]
},
"~": [
{
"condition": "editor.selection.isEmpty",
"true": {
"command": "cursorMove",
"args": "{ to: 'right', select: true }"
},
"false": [],
},
{
"condition": "__selection == __selection.toUpperCase()",
"true": "editor.action.transformToLowercase",
"false": "editor.action.transformToUppercase"
},
"modaledit.cancelMultipleSelections",
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment