Skip to content

Instantly share code, notes, and snippets.

@Fred-Vatin
Last active June 29, 2026 19:23
Show Gist options
  • Select an option

  • Save Fred-Vatin/1ee66dc947c9e620e1de0ccd2d403bac to your computer and use it in GitHub Desktop.

Select an option

Save Fred-Vatin/1ee66dc947c9e620e1de0ccd2d403bac to your computer and use it in GitHub Desktop.
#:master-keybindings
# author: David Little
# license: MIT https://github.com/haberdashPI/vscode-master-key/blob/main/LICENSE.md
## # Larkin Keybindings
## Larkin is a comprehensive keybinding set used daily by the author of master-key (@haberdashPI). It follows in the footsteps of Vim, Kakoune and Helix.
## > ℹ **Info**
## >
## > If your needs require a layout independent keymap consider changing "Use Layout Independent Bindings" in settings to true. It will transform all bindings to use the layout independent versions of the keys. For example the binding for `w` will be transformed to `[KeyW]`, which corresponds to the location of the letter "W" in the U.S. Keyboard layout.
# NOTE: this file is used to generate both keybindings and to generate a markdown file that documents the bindings. When comments are prefixed `##` they are included in the final markdown output. All other comments will be ignored.
[header]
name = "Larkin"
version = "2.0.0"
requiredExtensions = [
"dbankier.vscode-quick-select",
"haberdashPI.vscode-select-by-indent",
"haberdashPI.selection-utilities",
"pustelto.bracketeer",
"wmaurer.change-case",
"pkief.markdown-checkbox",
"jack89ita.open-file-from-path",
"koalamer.labeled-bookmarks",
"dnut.rewrap-revived",
"sa2taka.vscode-sandwich",
]
[[mode]]
name = "insert"
whenNoBinding = "insertCharacters"
[[mode]]
name = "normal"
default = true
highlight = "Highlight"
cursorShape = "Block"
[[mode]]
name = "visual"
highlight = "Highlight"
cursorShape = "Block"
whenNoBinding.useMode = "normal"
[[mode]]
name = "selectedit"
highlight = "Highlight"
cursorShape = "BlockOutline"
[[define.val]]
select = false
[[kind]]
name = "motion"
description = "These commands move the cursor and/or selections."
[[kind]]
name = "action"
description = """
Actions do something with the selected text (e.g. delete it). Unless otherwise noted, in the absence of a selection, an action will modify an entire line, and a count argument indicates the number of lines (e.g. 3d deletes this line and the next 3 lines).
"""
[[kind]]
name = "util"
description = """
Assorted other commands that aren't motions or actions
"""
[[define.command]]
id = "selectLinesDown"
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
{ skipWhen = "{{key.count <= 0}}", command = "cursorMove", args = { to = "down", by = "wrappedLine", select = true, value = "{{key.count}}" } },
"expandLineSelection",
"selection-utilities.exchangeAnchorActive",
]
[[define.command]]
id = "selectLinesUp"
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
{ skipWhen = "{{key.count <= 0}}", command = "cursorMove", args = { to = "up", by = "wrappedLine", select = true, value = "{{key.count}}" } },
"expandLineSelection",
]
[[define.bind]]
id = "modes"
doc.kind = "util"
## ### Getting Help
## There are three kinds of help available in Master Key:
[[bind]]
# default = "{{bind.util}}"
key = "Shift+F1"
doc.name = "toggle suggest panel"
finalKey = false
prefixes.any = true
mode = '{{not_modes(["insert"])}}'
doc.description = """
show command suggestions within the context of the current mode and keybinding prefix
(if any). E.g. `TAB, ⇧;` in `normal` mode will show all `normal` command suggestions that
start with `TAB`.
"""
command = "master-key.toggleSuggestionsInAuxiliaryBar"
# [[bind]]
# key = "ctrl+/"
# doc.name = "text docs"
# priority = -1
# mode = "normal"
# doc.description = "Show text documentation for keybindings"
# command = "master-key.showTextDoc"
[[bind]]
key = "tab f1"
doc.name = "visual doc"
priority = -1
mode = "normal"
doc.description = "Show visual documentation for keybindings"
command = "master-key.showVisualDoc"
## ## Essential Commands
## Larkin has a core set of commands that should be familiar to users of Helix or Vim.
## ### Normal Mode
## The default mode in Larkin is Normal mode. In this mode, instead of the keys entering text, all keys are commands that modify selections or perform actions on those selections. To exit normal mode you can use `i` to enter `insert` mode, which returns VSCode keybindings to their normal state (see [Simple actions](#simple-actions) for more ways to enter insert mode).
## While in Normal mode you will see a highlighted section with the text "normal" in the lower left hand corner of the status bar.
[[bind]]
default = "{{bind.modes}}"
doc.name = "normal"
doc.description = "Enter normal mode"
foreach.key = ["escape", "ctrl+[BracketLeft]"]
doc.combined.key = "escape/ctrl+["
doc.combined.name = "normal"
doc.combined.description = "Enter normal mode"
key = "{{key}}"
mode = '{{all_modes() + ["capture"]}}'
command = "runCommands"
args.commands = [
"master-key.enterNormal",
{ command = "master-key.setValue", args = { name = "select", value = false } },
]
when = "!findWidgetVisible"
prefixes.any = true
[[bind]]
default = "{{bind.modes}}"
doc.name = "normal"
foreach.key = ["escape", "ctrl+[BracketLeft]"]
key = "{{key}}"
doc.hideInPalette = true
doc.hideInDocs = true
when = "suggestWidgetVisible && editorTextFocus && !findWidgetVisible"
command = "runCommands"
args.commands = [
"hideSuggestWidget",
"master-key.enterNormal",
{ command = "master-key.setValue", args = { name = "select", value = false } },
]
mode = "{{all_modes()}}"
prefixes.any = true
[[define.bind]]
id = "edit"
when = "editorTextFocus && !findWidgetVisible"
mode = "normal"
[[define.bind]]
id = "edit_count"
default = "{{bind.edit}}"
doc.kind = "count"
## ### Simple motions
## These are the simplest motions that can be performed in Larkin.
[[define.bind]]
id = "edit_motion"
default = "{{bind.edit}}"
doc.kind = "motion"
tags = ["motion"]
[[define.bind]]
id = "edit_motion_prim"
default = "{{bind.edit_motion}}"
command = "cursorMove"
args.value = "{{key.count}}"
args.select = "{{code.editorHasSelection || val.select}}"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "h"
doc.name = "←"
doc.combined.name = "←/→"
doc.combined.key = "h/l"
doc.combined.description = "move left/right"
doc.description = "move left"
args.to = "left"
mode = "normal"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "l"
doc.combined.name = "←/→"
doc.name = "→"
doc.description = "move right"
args.to = "right"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "j"
doc.name = "↓"
doc.combined.name = "↓/↑"
doc.combined.key = "j/k"
doc.combined.description = "move down/up"
doc.description = "move down"
args.to = "down"
args.by = "line"
# args.by = "wrappedLine"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "k"
doc.name = "↑"
doc.description = "move up"
doc.combined.name = "↓/↑"
args.to = "up"
# args.by = "wrappedLine"
args.by = "line"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "shift+h"
doc.name = "start"
doc.description = "start of line (alternates between first non-white and first)"
doc.combined.name = "start/end (line select)"
doc.combined.key = "shift+h/shift+l"
doc.combined.description = "move and select to start/end of line"
command = "cursorHomeSelect"
[[bind]] # we don't use prim because we don't want the defaults
default = "{{bind.edit_motion}}"
key = "shift+l"
doc.name = "end"
doc.combined.name = "start/end (line select)"
doc.description = "end of line"
command = "cursorMove"
args.to = "wrappedLineEnd"
args.select = true
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "shift+k"
doc.name = "sel ↑"
doc.combined.name = "sel ↑/↓ (line select)"
doc.combined.description = "select lines up/down"
doc.combined.key = "shift+k/shift+j"
doc.description = "select lines upwards"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorMove"
args = { to = "up", by = "wrappedLine", select = true, value = "{{key.count}}" }
[[bind.args.commands]]
command = "expandLineSelection"
[[bind.args.commands]]
command = "selection-utilities.exchangeAnchorActive"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "shift+j"
doc.name = "sel ↓"
doc.combined.name = "sel ↑/↓ (line select)"
doc.description = "select lines downwards"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorMove"
args = { to = "down", by = "wrappedLine", select = true, value = "{{key.count}}" }
[[bind.args.commands]]
command = "expandLineSelection"
## Like VIM, the number keys (0-9) can be typed as a prefix to most commands and serve as a `count` argument to that command. In most cases this causes the command to be repeated `count` times e.g. 10j moves ten lines down.
# # Top row — original behavior unchanged
# [[bind]]
# foreach.num = ['{{keys(`[0-9]`)}}']
# doc.name = "count {{num}}"
# key = "{{num}}"
# command = "master-key.updateCount"
# doc.description = "Add digit {{num}} to the count argument of a command"
# doc.combined.key = "0-9"
# doc.combined.name = "count 0-9"
# doc.combined.description = "Add digit 0-9 to count argument of a command"
# args.value = "{{num}}"
# finalKey = false
# mode = '{{not_modes(["insert"])}}'
# Numpad — args.value extracts number from "numpad0"..."numpad9"
[[bind]]
foreach.num = ['{{keys(`numpad[0-9]`)}}']
doc.name = "count {{num}}"
key = "{{num}}"
command = "master-key.updateCount"
doc.description = "Add digit (numpad) to the count argument of a command"
doc.combined.key = "0-9"
doc.combined.name = "count 0-9"
doc.combined.description = "Add digit 0-9 to count argument of a command"
args.value = '{{num[num.len()-1..num.len()]}}'
finalKey = false
mode = '{{not_modes(["insert"])}}'
## ### Simple Actions
## Basic actions available in Larkin that can be used to edit text in relation to either the current line or the currently selected text.
[[define.bind]]
id = "edit_action"
doc.kind = "action"
mode = "normal"
tags = ["action"]
[[bind]]
default = "{{bind.edit_action}}"
key = "i"
doc.name = "insert"
doc.description = "Insert mode before cursor"
command = "runCommands"
# args.commands = ["selection-utilities.shrinkToActive", "master-key.enterInsert"]
args.commands = ["master-key.enterInsert"]
mode = '{{["normal", "selectedit", "syminsert"]}}'
[[bind]]
default = "{{bind.edit_action}}"
key = "a"
doc.name = "append"
doc.description = "Insert mode after cursor"
mode = '{{["normal", "selectedit", "syminsert"]}}'
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
"cursorRight",
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "c"
doc.name = "change (line)"
doc.description = """
Without a count: change selected region or all text from cursor to end of line. With a count: change up to `count` lines.
"""
when = "editorHasMultilineSelection"
command = "runCommands"
args.commands = [
"deleteRight",
"editor.action.insertLineBefore",
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "c"
when = "!editorHasMultilineSelection && editorHasSelection"
command = "runCommands"
args.commands = ["deleteRight", "master-key.enterInsert"]
[[bind]]
default = "{{bind.edit_action}}"
key = "c"
when = "!editorHasSelection && master-key.count <= 1"
command = "runCommands"
args.commands = [
# "expandLineSelection",
"deleteRight",
"editor.action.insertLineBefore",
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "c"
when = "!editorHasSelection && master-key.count > 1"
command = "runCommands"
args.commands = [
"{{command.selectLinesDown}}",
"deleteRight",
"editor.action.insertLineBefore",
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "d"
doc.name = "delete (line)"
doc.description = """
Without a count: delete selected text (and store to clipboard) or the current line if no
selection exists. With a count, delete up to the next `count` lines and store to clipboard
"""
when = "!editorHasSelection"
command = "runCommands"
args.commands = [
"{{command.selectLinesDown}}",
"editor.action.clipboardCutAction",
{ command = "master-key.setMode", args = { value = "normal" } },
]
[[bind]]
default = "{{bind.edit_action}}"
key = "d"
when = "editorHasSelection"
command = "runCommands"
args.commands = [
"editor.action.clipboardCutAction",
{ command = "master-key.setMode", args = { value = "normal" } },
]
[[bind]]
default = "{{bind.edit_action}}"
key = "y"
doc.name = "copy (line)"
doc.description = "Copy selected text to clipboard or the entire line if there is no selection. With a count, copy up to the next `count` lines."
command = "runCommands"
args.commands = [
"editor.action.clipboardCopyAction",
"selection-utilities.shrinkToActive",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "y"
when = "master-key.count > 1"
command = "runCommands"
args.commands = [
"{{command.selectLinesDown}}",
"editor.action.clipboardCopyAction",
"selection-utilities.shrinkToActive",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "p"
doc.name = "paste after"
doc.description = "Paste clipboard after the cursor/selection"
doc.combined.name = "paste after/before/in"
doc.combined.description = "Paste clipboard after/before/at the cursor/selection"
doc.combined.key = "p/shift+p/ctrl+p"
when = "editorHasSelection"
command = "runCommands"
args.commands = [
"selection-utilities.activeAtEnd",
"selection-utilities.shrinkToActive",
"editor.action.clipboardPasteAction",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "p"
doc.name = "paste after"
when = "!editorHasSelection"
command = "runCommands"
doc.combined.name = "paste after/before/in"
args.commands = ["cursorRight", "editor.action.clipboardPasteAction"]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+p"
doc.name = "paste before"
doc.combined.name = "paste after/before/in"
doc.description = "Paste before the cursor/selection"
when = "editorHasSelection"
command = "runCommands"
args.commands = [
"selection-utilities.activeAtStart",
"selection-utilities.shrinkToActive",
"editor.action.clipboardPasteAction",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+p"
when = "!editorHasSelection"
doc.combined.name = "paste after/before/in"
command = "editor.action.clipboardPasteAction"
[[bind]]
default = "{{bind.edit_action}}"
key = "ctrl+p"
when = "!suggestWidgetVisible && !inQuickInput"
mode = ["normal", "insert"]
doc.combined.name = "paste after/before/in"
doc.name = "paste in"
doc.description = "Paste clipboard at location"
command = "editor.action.clipboardPasteAction"
[[bind]]
default = "{{bind.edit_action}}"
args.commands = [
"selection-utilities.shrinkToActive",
{ command = "cursorMove", args = { to = "right", select = true, value = "{{key.count}}" } },
"editor.action.clipboardCutAction",
]
key = "x"
mode = "normal"
doc.name = "delete char"
doc.description = "Delete character(s) under the cursor and store to clipboard. Accept a count to delete multiple characters."
command = "runCommands"
## ### Repeating Motions and Actions
## There are a few ways to make repetitive motions and actions easier.
[[bind]]
default = "{{bind.edit_motion}}"
key = ","
doc.name = "\trepeat motion"
doc.description = """
Repeat the last motion command. Motions usually move the cursor or change the selection.
"""
repeat = "{{key.count}}"
command = "master-key.replayFromHistory"
args.index = """{{
last_history_index(|i| {
(history[i]?.tags?.contains("motion") ?? false) &&
(history[i]?.doc?.name != "repeat motion" ?? false) &&
(history[i]?.doc?.name != "shrink selection" ?? false)
})
}}"""
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "\trepeat subject"
doc.description = """
Repeat the subject: a motion command that occurred right before an action. For
instance `w` followed by `d` selects a word and deletes it. The `w` command would be the
last subject until some new action is run. See also `.` which repeats the last action.
"""
key = "ctrl+,"
command = "master-key.replayFromHistory"
args.index = """{{
last_history_index(|i| {
(history[i]?.tags?.contains("motion") ?? false) &&
(history[i+1]?.tags?.contains("action") ?? false) &&
!((history[i+1]?.doc?.name?.starts_with("repeat") ?? false) &&
(history[i+1]?.tags?.contains("history") ?? false))
})
}}"""
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "\trepeat action"
doc.description = """
Repeat the last action command. Actions usually modify the text of a document in one way or
another. (But, e.g. sending text to the REPL is also considered an editor action).
See also `,` which repeats the last "subject" of an action (the selection preceding an action).
"""
key = "."
command = "runCommands"
repeat = "{{key.count}}"
[[bind.args.commands]]
command = "master-key.replayFromHistory"
# we can repeat any action but history-related actions; we make an exception for replaying macros, which can be repeated
args.index = """{{
last_history_index(|i|
history[i]?.tags.contains("action") &&
!(history[i]?.tags.contains("history") && history[i]?.doc.name != "replay")
)}}"""
[[bind.args.commands]]
command = "master-key.enterNormal"
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "\trepeat command"
doc.description = """
Repeat the last command, whatever it was. Also see `repeat action`.
"""
key = "ctrl+."
command = "runCommands"
repeat = "{{key.count}}"
[[bind.args.commands]]
command = "master-key.replayFromHistory"
args.index = """{{last_history_index(|i|
!(history[i]?.tags.contains("history") && history[i]?.doc.name != "replay")
)}}"""
[[bind.args.commands]]
command = "master-key.enterNormal"
## ### Standard Motions
## These are relatively common motions that compliment the [Basic Motions](#basic-motions).
## Selection behavior uses the following logic: motions that move more than one character generally select the text "under" the motion. If a selection already exists (e.g. from a previous motion) additional motions extend that selection. You can always reset the selection using `v`, and several commands (e.g. `x`) operate on the next character rather than the current selection.
## Word and section motions are defined using [Selection Utilities](https://haberdashpi.github.io/vscode-selection-utilities/)'s unit definitions for [moveBy](https://haberdashpi.github.io/vscode-selection-utilities/commands/moveBy.html), and can be configured per language.
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "ctrl+d"
mode = '{{not_modes(["insert"])}}'
doc.name = "pg ↓"
doc.combined.name = "pg ↓/↑ (select lines)"
doc.combined.key = "ctrl+d/ctrl+u"
doc.combined.description = "select down/up, relative to page size"
doc.description = "select down, relative to page size"
command = "selection-utilities.activePageMove"
args.dir = "down"
args.count = "{{max(key.count, 1)/3}}"
args.select = '{{key.mode == "normal"}}'
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "ctrl+u"
mode = '{{not_modes(["insert"])}}'
doc.name = "pg ↑"
doc.combined.name = "pg ↓/↑ (select lines)"
doc.description = "select up, relative to page size"
command = "selection-utilities.activePageMove"
args.dir = "up"
args.count = "{{(max(key.count, 1))/3}}"
args.select = '{{key.mode == "normal"}}'
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "shift+x"
doc.name = "select line(s)"
doc.description = "expand selections to full lines"
command = "expandLineSelection"
repeat = "{{key.count}}"
[[define.bind]]
id = "edit_motion_obj"
default = "{{bind.edit_motion}}"
command = "selection-utilities.moveBy"
args.boundary = "start"
args.select = true
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "w"
doc.name = "subword →"
doc.description = "next subword (camel/snake case)"
doc.combined.name = "subword ←/→ (sel)"
doc.combined.description = "next/prev subword (camel/snake case)"
doc.combined.key = "w/b"
args.unit = "subword"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "b"
doc.name = "subword ←"
doc.description = "previous subword (camel/snake case)"
doc.combined.name = "subword ←/→ (sel)"
args.unit = "subword"
args.value = "{{-max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "shift+w"
doc.name = "word →"
doc.description = "next word"
doc.combined.name = "word ←/→ (sel)"
doc.combined.description = "next/prev word"
doc.combined.key = "shift+w/b"
args.unit = "word"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "shift+b"
doc.name = "word ←"
doc.combined.name = "word ←/→ (sel)"
doc.description = "previous word"
args.unit = "word"
args.value = "{{-max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "e"
doc.name = "subword end (sel)"
doc.combined.name = "subword/word end (sel)"
doc.combined.description = "select next subword (camel/snake case) or full word end"
doc.combined.key = "e/shift+e"
doc.description = "next subword (camel/snake case) end"
args.unit = "subword"
args.boundary = "end"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "shift+e"
doc.name = "word end (sel)"
doc.combined.name = "subword/word end (sel)"
doc.description = "next word end"
args.unit = "word"
args.boundary = "end"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "shift+9"
doc.name = "parag. →"
doc.description = "next paragraph"
doc.combined.name = "paragraph →/← (sel)"
doc.combined.description = "next/previous paragraph"
doc.combined.key = "shift+) / shift+("
args.unit = "paragraph"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "shift+4"
doc.name = "parag. ←"
doc.combined.name = "paragraph →/← (sel)"
doc.description = "previous paragraph"
args.unit = "paragraph"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "9"
doc.name = "parag. →"
doc.description = "next paragraph"
doc.combined.name = "paragraph →/←"
doc.combined.description = "next/previous paragraph"
doc.combined.key = ") / ("
args.unit = "paragraph"
args.value = "{{max(key.count, 1)}}"
args.select = false
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "4"
doc.name = "parag. ←"
doc.combined.name = "paragraph →/←"
doc.description = "previous paragraph"
args.unit = "paragraph"
args.value = "{{-(max(key.count, 1))}}"
args.select = false
# [[bind]]
# default = "{{bind.edit_motion_obj}}"
# key = "shift+0"
# doc.name = "subsec →"
# doc.description = "next subsection"
# doc.combined.name = "subsec →/← (sel)"
# doc.combined.description = "next/previous subsection"
# doc.combined.key = "shift+0/9"
# args.unit = "subsection"
# args.value = "{{max(key.count, 1)}}"
# [[bind]]
# default = "{{bind.edit_motion_obj}}"
# key = "shift+9"
# doc.name = "subsec ←"
# doc.description = "previous subsection"
# doc.combined.name = "subsec →/← (sel)"
# args.unit = "subsection"
# args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "v"
doc.name = "deselect"
doc.combined.name = "deselect/hold selection (visual mode)"
doc.combined.description = """
reduce selections to zero length / make all commands extend the selection
"""
doc.description = """
reduce all selections to length zero
"""
doc.combined.key = "v/shift+v"
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
"master-key.enterNormal",
{ command = "master-key.setValue", args = { name = "select", value = false } },
]
[[bind]]
default = "{{bind.modes}}"
key = "shift+v"
mode = "normal"
doc.name = "hold selection"
doc.combined.name = "deselect/hold selection (visual mode)"
doc.description = """
all motions extend the selection
"""
command = "runCommands"
args.commands = [
{ command = "master-key.setMode", args = { value = "visual" } },
{ command = "master-key.setValue", args = { name = "select", value = true } },
]
when = "editorTextFocus && !findWidgetVisible"
# [[bind]]
# default = "{{bind.edit_motion}}"
# key = "shift+v"
# doc.name = "hold selection"
# doc.combined.name = "shrink/hold selection (visual mode)"
# doc.description = """
# all motions extend the selection
# """
# command = "master-key.setValue"
# args.name = "select"
# args.value = true
[[bind]]
default = "{{bind.edit_action}}"
doc.name = "add line below"
doc.description = "with selection: move cursor to start"
key = "o"
doc.combined.name = "add line below/above"
doc.combined.key = "o/shift+o"
doc.combined.description = """
without selection: open a line below/above current line and enter insert
"""
when = "!editorHasSelection"
command = "runCommands"
args.commands = ["editor.action.insertLineAfter", "master-key.enterInsert"]
[[bind]]
default = "{{bind.edit_action}}"
key = "o"
doc.name = "move cursor in sel →"
doc.combined.name = "move cursor in sel →/←"
doc.combined.key = "o/shift+o"
doc.combined.description = "with selection: move cursor to start/end of selection"
doc.description = "with selection: move cursor to end of selection"
when = "editorHasSelection"
command = "selection-utilities.activeAtEnd"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = "add line above"
doc.combined.name = "add line below/above"
doc.description = "without selection: open a line above current line and enter insert"
key = "shift+o"
when = "!editorHasSelection"
command = "runCommands"
args.commands = ["editor.action.insertLineBefore", "master-key.enterInsert"]
[[bind]]
default = "{{bind.edit_action}}"
doc.name = "move cursor in sel ←"
doc.combined.name = "move cursor in sel →/←"
doc.description = "with selection: move cursor to start of selection"
key = "shift+o"
when = "editorHasSelection"
command = "selection-utilities.activeAtStart"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = '\'
doc.name = "→ sel"
doc.combined.name = "→ (←) sel"
doc.description = "select *just* the character to the right"
doc.combined.description = "select *just* the character to the right (left)"
doc.combined.key = '\ / shift+\'
mode = ["normal", "selectedit"]
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorMove"
args = { to = "right", select = true, value = "{{key.count}}" }
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = 'shift+\'
doc.name = "← sel"
doc.combined.name = "→ (←) sel"
doc.description = "select *just* the character to the left"
mode = ["normal", "selectedit"]
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorMove"
args = { to = "left", select = true, value = "{{key.count}}" }
# [[bind]]
# default = "{{bind.edit_motion_obj}}"
# key = "shift+4"
# doc.name = "all"
# doc.description = "Select entire document"
# command = "editor.action.selectAll"
[[bind]]
default = "{{bind.edit_motion}}"
key = "shift+r"
doc.name = "trim white space"
doc.description = "trim external whitespace from selection"
command = "selection-utilities.trimSelectionWhitespace"
[[bind]]
default = "{{bind.edit_motion_obj}}"
doc.name = "→ num."
doc.description = "Move to next number"
key = "shift+3"
doc.combined.name = "→/← num."
doc.combined.description = "Move to next/prev number"
doc.combined.key = "shift+3/2"
args.unit = "number"
args.selectWhole = true
args.boundary = "both"
args.value = "{{(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
doc.name = "← num."
doc.description = "Move to previous number"
key = "shift+2"
doc.combined.name = "→/← num."
args.unit = "number"
args.selectWhole = true
args.boundary = "both"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = 'narrow to subword'
doc.description = "Narrow current selection so it starts and stops at a subword (e.g. 'snake' in snake_case)"
key = "z"
command = "selection-utilities.narrowTo"
args.unit = "subident"
args.boundary = "both"
## ### Standard Actions
## These are the some common actions, that compliment the [Simple Actions](#simple-actions).
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+i"
doc.name = "insert start"
doc.description = "Insert at start of line"
mode = '{{["normal", "selectedit", "syminsert"]}}'
command = "runCommands"
args.commands = [
{ command = "cursorMove", args = { to = "wrappedLineFirstNonWhitespaceCharacter", select = false } },
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+a"
doc.name = "insert end"
doc.description = "Insert at end of line"
mode = '{{["normal", "selectedit", "syminsert"]}}'
command = "runCommands"
args.commands = [
{ command = "cursorMove", args = { to = "wrappedLineEnd", select = false } },
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+c"
doc.name = "change to/back"
doc.description = """Without a count: change from current char to end of line. With a count:
change the previous `count` lines.
"""
mode = "normal"
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
"deleteAllRight",
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+c"
mode = ["normal", "selectedit"]
when = "master-key.count > 1"
command = "runCommands"
args.commands = [
"{{command.selectLinesUp}}",
"deleteRight",
"editor.action.insertLineBefore",
"master-key.enterInsert",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+d"
mode = "normal"
doc.name = "del. to"
doc.description = "without count: Delete from cursor to end of line; with count: Delete from current line up `count` number of keys."
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
{ command = "cursorMove", args = { to = "wrappedLineEnd", select = true } },
"editor.action.clipboardCutAction",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+d"
mode = "normal"
when = "master-key.count > 1"
command = "runCommands"
args.commands = ["{{command.selectLinesUp}}", "deleteRight"]
[[bind]]
default = "{{bind.edit_action}}"
key = "r"
doc.name = "replace char"
doc.description = "replace the character under the cursor"
command = "master-key.replaceChar"
[[bind]]
default = "{{bind.edit_action}}"
key = "ctrl+i"
doc.name = "insert char"
mode = ["normal", "selectedit"]
doc.description = "insert one character in front of the cursor"
command = "master-key.insertChar"
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "undo"
doc.description = "undo last action"
doc.combined.name = "undo/redo"
doc.combined.description = "undo/redo last action"
doc.combined.key = "u/shift+u"
key = "u"
command = "runCommands"
args.commands = ["undo", "selection-utilities.shrinkToActive"]
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "redo"
doc.description = "redo last action"
doc.combined.name = "undo/redo"
key = "shift+u"
command = "runCommands"
args.commands = ["redo", "selection-utilities.shrinkToActive"]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+y"
doc.name = "copy (eol/up)"
doc.description = "without a count: copy to end of line; with a count: copy this and the previous N lines"
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
{ command = "cursorMove", args = { to = "wrappedLineEnd", select = true } },
"editor.action.clipboardCopyAction",
"selection-utilities.shrinkToActive",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+y"
when = "master-key.count > 1"
command = "runCommands"
args.commands = [
"{{command.selectLinesUp}}",
"editor.action.clipboardCopyAction",
"selection-utilities.shrinkToActive",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+."
doc.name = "indent"
doc.description = "Indent lines"
command = "editor.action.indentLines"
[[bind]]
args.commands = ["{{command.selectLinesDown}}", "editor.action.indentLines"]
default = "{{bind.edit_action}}"
key = "shift+."
doc.name = "indent"
doc.description = "Indent lines"
when = "master-key.count >= 1"
command = "runCommands"
[[bind]]
default = "{{bind.edit_action}}"
key = "shift+,"
doc.name = "deindent"
doc.description = "De-indent lines"
command = "editor.action.outdentLines"
[[bind]]
args.commands = [
"{{command.selectLinesDown}}",
"editor.action.outdentLines",
"selection-utilities.shrinkToActive",
]
default = "{{bind.edit_action}}"
key = "shift+,"
doc.name = "deindent"
when = "master-key.count >= 1"
doc.description = "Deindent lines"
command = "runCommands"
[[define.bind]]
id = "edit_action_history"
default = "{{bind.edit_action}}"
tags = ["history"]
## ### Motion History
## These commands interact with the history of cursor motions and selections moving
## backwards from the current state or reversing this backwards motion.
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "cursor undo"
key = "Backspace"
doc.combined.name = "cursor undo/redo"
doc.combined.key = "-/shift+-"
command = "cursorUndo"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "cursor redo"
doc.combined.name = "cursor undo/redo"
key = "shift+Backspace"
command = "cursorRedo"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "nav ←"
doc.description = "Go back in navigation history (e.g. goto definition)"
doc.combined.name = "nav ←/→"
doc.combined.key = "n/shift+n"
doc.combined.description = "Go back/forward in navigation history"
key = "g n"
command = "workbench.action.navigateBackInNavigationLocations"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "nav →"
doc.combined.name = "nav ←/→"
doc.description = "Go forward in navigation history (e.g. goto definition)"
key = "g shift+n"
command = "workbench.action.navigateForwardInNavigationLocations"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "edit hist ←"
doc.description = "Go back in edit history"
key = "g [Minus]"
doc.combined.name = "edit ←/→"
doc.combined.key = "-/shift+-"
doc.combined.description = "Go back/forward in edit history"
command = "workbench.action.navigateBackInEditLocations"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "edit hist →"
doc.description = "Go forward in edit history)"
key = "g shift+[Minus]"
doc.combined.name = "edit ←/→"
command = "workbench.action.navigateForwardInEditLocations"
## ### Search Motions
## Search motions accept one or more characters and select text up until the given character. Search commands are case insensitive by default. They can serve as very efficient ways to jump to a desired location. E.g. typing `sfod` in normal mode would delete the first three words of the following line of text
## > I want some food
[[define.bind]]
id = "edit_motion_search"
default = "{{bind.edit_motion}}"
command = "master-key.search"
args.caseSensitive = false
args.backwards = false
args.selectTillMatch = true
args.wrapAround = true
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "[Delete]"
doc.name = "search →"
doc.description = "search forwards"
doc.combined.name = "search → (←)"
doc.combined.description = "search forwards (backwards)"
doc.combined.key = "delete (shift+delete)"
args.offset = "start"
args.register = "search"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+[Delete]"
doc.name = "search ←"
doc.description = "search backwards"
doc.combined.name = "search → (←)"
args.offset = "start"
args.register = "search"
args.backwards = true
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+8"
doc.name = "match →"
doc.description = "Next match to object under cursor"
doc.combined.name = "match →/←"
doc.combined.description = "Next/previous match to object under cursor"
doc.combined.key = "shift+8/7"
args.text = "{{code.firstSelectionOrWord}}"
args.offset = "start"
args.register = "search"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+7"
doc.name = "match ←"
doc.description = "Previous match to object under cursor"
doc.combined.name = "match →/←"
args.text = "{{code.firstSelectionOrWord}}"
args.offset = "start"
args.register = "search"
args.backwards = true
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "f"
doc.name = "find char"
doc.description = "Find the next char (include char in selection)"
doc.combined.name = "find char (back)"
doc.combined.description = "Find the next (previous) char (include char in selection)"
doc.combined.key = "f/shift+f"
args.register = "search"
args.acceptAfter = 1
args.skip = "{{key.count-1}}"
args.offset = "fartherBoundary"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+f"
doc.name = "find char back"
doc.description = "Find the previous char (include char in selection)"
doc.combined.name = "find char (back)"
args.register = "search"
args.acceptAfter = 1
args.offset = "fartherBoundary"
args.backwards = true
args.skip = "{{key.count-1}}"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "t"
doc.name = "to char"
doc.description = "Find the next char (exclude char in selection)"
doc.combined.name = "to char →/←"
doc.combined.key = "t (shift+t)"
doc.combined.description = "Find the next/previous char (exclude char in selection)"
args.register = "search"
args.acceptAfter = 1
args.offset = "start"
args.skip = "{{key.count-1}}"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+t"
doc.name = "to char back"
doc.description = "Find the previous char (exclude char in selection)"
doc.combined.name = "to char →/←"
args.register = "search"
args.acceptAfter = 1
args.offset = "end"
args.backwards = true
args.skip = "{{key.count-1}}"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "s"
doc.name = "find char pair"
doc.description = "To next character pair"
doc.combined.name = "char pair →/←"
doc.combined.description = "To next/previous character pair"
doc.combined.key = "s/shift+s"
args.register = "search"
args.acceptAfter = 2
args.offset = "start"
args.skip = "{{key.count-1}}"
mode = "normal"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+s"
doc.name = "char pair back"
doc.description = "To previous character pair"
doc.combined.name = "char pair →/←"
args.register = "search"
args.acceptAfter = 2
args.offset = "start"
args.skip = "{{key.count-1}}"
args.backwards = true
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "n"
doc.name = "→ match"
doc.description = "Go to the next match of the search query"
doc.combined.name = "match → (←)"
doc.combined.description = "Go to the next/previous match of the search query"
doc.combined.key = "n/shift+n"
command = "master-key.nextMatch"
args.register = "search"
args.repeat = "{{(max(key.count, 1))-1}}"
[[bind]]
default = "{{bind.edit_motion_search}}"
key = "shift+n"
doc.combined.name = "match → (←)"
doc.name = "← match"
doc.description = "Go to the previous match of the search query"
command = "master-key.previousMatch"
args.register = "search"
args.repeat = "{{(max(key.count, 1))-1}}"
## ## Advanced Commands
## Advanced commands comprise a much broader set of behaviors than the essential commands but an experienced user would be expected to make frequent use of many of these commands.
## ### Goto Motions
## Goto motions all begin with the mnemonic prefix key `g`. They are additional motion commands that compliment the simple and standard actions.
## Word and section motions are defined using [Selection Utilities](https://haberdashpi.github.io/vscode-selection-utilities/)'s unit definitions for [moveBy](https://haberdashpi.github.io/vscode-selection-utilities/commands/moveBy.html), and can be configured per language.
[[bind]]
default = "{{bind.edit_motion}}"
key = "g"
priority = 1
doc.name = "goto…"
command = "master-key.prefix"
doc.description = """
Goto commands move the location of the cursor (or the active selection position) forward
or backwards in some direction.
"""
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "shift+g"
priority = 1
doc.name = "doc end"
doc.description = "select to end of document"
doc.combined.name = "doc top/bottom (sel)"
doc.combined.description = "select to top/bottom of document"
doc.combined.key = "gg / shift+g"
command = "cursorBottomSelect"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "g g"
priority = 1
doc.name = "doc top"
doc.description = "select to top of document"
doc.combined.name = "doc top/bottom (sel)"
doc.combined.description = "select to top/bottom of document"
doc.combined.key = "g g/shift+g"
command = "cursorTopSelect"
# [[bind]]
# default = "{{bind.edit_motion_prim}}"
# key = "g g"
# priority = 1
# doc.name = "doc start"
# doc.description = "select to start (line) of document."
# doc.combined.name = "doc start/end (sel)"
# doc.combined.description = "select to start/end of document"
# doc.combined.key = "g g/shift+g"
# command = "runCommands"
# when = "master-key.count > 1"
# [[bind.args.commands]]
# command = "cursorTop"
# [[bind.args.commands]]
# command = "cursorMove"
# args.to = "down"
# args.by = "wrappedLine"
# args.value = "{{key.count-1}}"
# [[bind.args.commands]]
# command = "revealLine"
# args.at = "center"
# args.lineNumber = "{{key.count}}"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "g j"
priority = 1
doc.name = "unwrap ↓"
doc.combined.name = "unwrap ↓/↑"
doc.combined.key = "j/k"
doc.combined.description = """
move cursor up/down unwrapped text line; if a single line is wrapped into multiple lines by
the editor, this command skips all such wrapped lines
"""
doc.description = """
down unwrapped line; if a single line is wrapped into multiple lines by the editor, this
command skips all such wrapped lines
"""
args.to = "down"
args.by = "line"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "g k"
priority = 1
doc.name = "unwrap ↑"
doc.combined.name = "unwrap ↓/↑"
doc.description = "up unwrapped line"
args.to = "up"
args.by = "line"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "g shift+k"
priority = 1
doc.combined.name = "unwrap sel ↑/↓"
doc.combined.description = "select unwrapped lines up/down"
doc.combined.key = "shift+k/j"
doc.name = "unwrap sel ↑"
doc.description = "select unwrapped lines upwards"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorMove"
args = { to = "up", by = "line", select = true, value = "{{key.count}}" }
[[bind.args.commands]]
command = "expandLineSelection"
[[bind]]
default = "{{bind.edit_motion_prim}}"
key = "g shift+j"
priority = 1
doc.name = "sel ↓"
doc.combined.name = "unwrap sel ↑/↓"
doc.description = "select unwrapped lines downwards"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorMove"
args = { to = "down", by = "line", select = true, value = "{{key.count}}" }
[[bind.args.commands]]
command = "expandLineSelection"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "g w"
priority = 1
doc.name = "WORD →"
doc.combined.name = "WORD →/←"
doc.combined.description = """
next/prev WORD; e.g. contiguous non-whitespace region
"""
doc.combined.key = "w/b"
doc.description = "next WORD; e.g. contiguous non-whitespace region"
args.unit = "BigWord"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "g b"
priority = 1
doc.name = "WORD ←"
doc.combined.name = "WORD →/←"
doc.description = "previous WORD; e.g. contiguous non-whitespace region"
args.unit = "BigWord"
args.value = "{{-max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "g e"
priority = 1
doc.name = "WORD end →"
doc.description = "next WORD end; i.e. contiguous non-whitespace region"
args.unit = "BigWord"
args.boundary = "end"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "g 0"
priority = 1
doc.name = "section →"
doc.description = "next section"
doc.combined.name = "section →/←"
doc.combined.description = "next/previous section"
doc.combined.key = "0/9"
args.unit = "section"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_obj}}"
key = "g 9"
priority = 1
doc.name = "section ←"
doc.description = "previous section"
doc.combined.name = "section →/←"
args.unit = "section"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.window}}"
doc.name = "goto line"
priority = 1
doc.description = "goto absolute line"
key = "g l"
command = "workbench.action.gotoLine"
[[bind]]
default = "{{bind.window}}"
doc.name = "to refs"
priority = 1
doc.description = "jump to a location where this symbol is referenced"
key = "g r"
command = "editor.action.goToReferences"
[[bind]]
default = "{{bind.window}}"
doc.name = "go to"
priority = 1
doc.description = "go to the definition of symbol under cursor"
key = "g d"
doc.combined.name = "go to (aside)"
doc.combined.key = "(shift+)d"
doc.combined.description = "go to the definition of symbol (in an editor to the side)"
command = "editor.action.revealDefinition"
[[bind]]
default = "{{bind.window}}"
doc.name = "go to, aside"
priority = 1
doc.description = "go to the definition of symbol under cursor in an editor to the side"
key = "g shift+d"
doc.combined.name = "go to (aside)"
command = "editor.action.revealDefinitionAside"
[[bind]]
default = "{{bind.window}}"
doc.name = "open"
doc.description = "open the file name under the cursor"
key = "g f"
command = "extension.openFileFromPath"
[[bind]]
default = "{{bind.edit_motion}}"
key = "g c"
doc.name = "cell →"
doc.combined.name = "cell →/←"
command = "runCommands"
args.commands = ["jupyter.gotoNextCellInFile", "jupyter.selectCell"]
doc.description = "previous jupyter notebook cell"
[[bind]]
default = "{{bind.edit_motion}}"
key = "g shift+c"
doc.name = "cell ←"
doc.combined.name = "cell →/←"
doc.description = "previous jupyter notebook cell"
command = "runCommands"
args.commands = ["jupyter.gotoPrevCellInFile", "jupyter.selectCell"]
## ### Match motions
## Match motions select some syntactical region of text, e.g. in or around parenthesis, brackets, indent level etc... Where the `g` prefixed commands move forward or backward, these commands move both the start and the end of the selection away from the active cursor position. Repeating the command moves to the next (or previous) match, depending on the command.
## If you accidentally select `around` instead of `in`, you can revise your selection using `R` to narrow to non-white space or `z` to narrow to a subword (e.g. excludes `_`)
## Many of the motions here are defined using [Selection Utilities](https://haberdashpi.github.io/vscode-selection-utilities/)'s unit definitions for [moveBy](https://haberdashpi.github.io/vscode-selection-utilities/commands/moveBy.html), and can be configured per language.
[[define.bind]]
id = "edit_motion_match_obj"
default = "{{bind.edit_motion}}"
command = "selection-utilities.moveBy"
doc.kind = "motion"
args.selectWhole = true
args.boundary = "start"
[[bind]]
default = "{{bind.edit_motion}}"
key = "shift+m"
doc.name = "smart expand"
doc.description = "Use VSCode's built-in smart expansion command"
command = "editor.action.smartSelect.expand"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m"
doc.name = "match (prefix)"
doc.description = """
Find the closest character range matching a specified object.
"""
doc.kind = "motion"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m m"
doc.name = "to bracket"
doc.description = "Move to matching bracket"
command = "editor.action.jumpToBracket"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m w"
doc.name = "around subword →"
doc.description = "(camel/snake case)"
doc.combined.name = "around subword ←/→"
doc.combined.description = "(camel/snake case)"
doc.combined.key = "w/b"
args.unit = "subword"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m b"
doc.name = "around subword ←"
doc.description = "(camel/snake case)"
doc.combined.name = "around subword ←/→"
args.unit = "subword"
args.value = "{{-max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+w"
doc.name = "around word →"
doc.combined.name = "around word →/←"
doc.combined.key = "shift+w/b"
args.unit = "word"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+b"
doc.name = "around word ←"
doc.combined.name = "around word →/←"
args.unit = "word"
args.value = "{{-max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m e"
doc.name = "in subword"
doc.combined.name = "in → subword/word"
doc.combined.key = "e/shift+e"
args.unit = "subident"
args.boundary = "both"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+e"
doc.name = "in word"
doc.combined.name = "in → subword/word"
args.unit = "word"
args.boundary = "both"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m p"
doc.name = "in parag. →"
doc.combined.name = "in paragraph →/←"
doc.combined.key = "p/o"
args.boundary = "both"
args.unit = "paragraph"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m o"
doc.name = "in parag. ←"
doc.combined.name = "in paragraph →/←"
args.unit = "paragraph"
args.boundary = "both"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+p"
doc.name = "around parag. →"
doc.combined.name = "around paragraph →/←"
doc.combined.key = "shift+p/shift+o"
args.unit = "paragraph"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+o"
doc.name = "around parag. ←"
doc.combined.name = "around paragraph →/←"
args.unit = "paragraph"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m 0"
doc.name = "around subsec →"
doc.combined.name = "around subsection →/←"
doc.combined.key = "0/shift+0"
args.unit = "subsection"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+0"
doc.name = "around subsec ←"
doc.combined.name = "around subsection →/←"
args.unit = "subsection"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m 9"
doc.name = "in subsec →"
doc.combined.name = "in subsection →/←"
doc.combined.key = "9/shift+9"
args.unit = "subsection"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m shift+9"
doc.name = "in subsec ←"
doc.combined.name = "in subsection →/←"
args.unit = "subsection"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m g"
doc.name = "other..."
doc.description = "additional objects to match..."
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m g 0"
doc.name = "section →"
doc.combined.name = "section →/←"
doc.combined.key = "0/9"
args.unit = "section"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m g 9"
doc.name = "section ←"
doc.combined.name = "section →/←"
args.unit = "section"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m g w"
doc.name = "around WORD →"
doc.combined.name = "around WORD →/←"
doc.combined.key = "w/b"
doc.combined.description = "expand around a WORD; a contiguous non-whitespace region"
args.unit = "BigWord"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m g b"
doc.name = "around WORD ←"
doc.combined.name = "around WORD →/←"
args.unit = "BigWord"
args.value = "{{-(max(key.count, 1))}}"
[[bind]]
default = "{{bind.edit_motion_match_obj}}"
key = "m g e"
doc.name = "in WORD"
doc.description = "select within a WORD; a contiguous non-whitespace region"
args.unit = "BigWord"
args.boundary = "both"
args.value = "{{max(key.count, 1)}}"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m 4"
doc.name = "in parens"
doc.combined.name = "in/around (), [], {}"
doc.combined.key = "( / shift+("
doc.combined.description = """
expand inside/around parens/brackets/braces and their contents; repeated calls to this command
will seek out larger and larger scopes
"""
doc.description = """
expand inside parens/brackets/braces and their contents; repeated calls to this command
will seek out larger and larger scopes
"""
command = "selection-utilities.expandWithinBrackets"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m shift+4"
doc.name = "around parens"
doc.combined.name = "in/around parens"
doc.description = """
expand inside parens/brackets/braces and their contents; repeated calls to this command
will seek out larger and larger scopes
"""
command = "selection-utilities.expandAroundBrackets"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m [Period]"
doc.name = "in quotes"
doc.description = """
select within current quotes; repeated calls to this command
will seek out larger and larger scopes
"""
doc.combined.name = "in/around quotes"
doc.combined.key = "\" / shift+\""
doc.combined.description = """
select within/around current quotes; repeated calls to this command
will seek out larger and larger scopes
"""
command = "bracketeer.selectQuotesContent"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m shift+[Period]"
doc.name = "around quotes"
doc.combined.name = "in/around quotes"
doc.description = """
select around current quotes; repeated calls to this command
will seek out larger and larger scopes
"""
command = "runCommands"
args.commands = [
"bracketeer.selectQuotesContent",
"bracketeer.selectQuotesContent",
]
[[bind]]
default = "{{bind.edit_motion}}"
key = "m ,"
doc.name = "in <>"
doc.description = "text inside angle brackets"
doc.combined.name = "in <> / in ><"
doc.combined.key = ", / ."
doc.combined.description = "text inside angle brackets / pairs"
command = "extension.selectAngleBrackets"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m ."
doc.name = "in ><"
doc.combined.name = "in <> / in ><"
doc.description = "text inside xml tag pairs"
command = "extension.selectInTag"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m space"
doc.name = "in indent"
doc.description = "all text at the same indentation level"
doc.combined.name = "in/around (indent)"
doc.combined.key = "space/shift+space"
doc.combined.description = """
all text at the same indentation level / all indentation along with the line above and
below this (ala c-like syntax)
"""
command = "vscode-select-by-indent.select-inner"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m shift+space"
doc.name = "around indent"
doc.description = """
all text at the same indentation level along with the line above and below
this (ala c-like syntax)
"""
doc.combined.name = "in/around (indent)"
command = "vscode-select-by-indent.select-outer"
[[bind]]
default = "{{bind.edit_motion}}"
key = "m g space"
doc.name = "indent+top"
doc.description = """
all text at the same indentation level and the line just above it (ala python syntax)
"""
command = "vscode-select-by-indent.select-outer-top-only"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "in cell"
doc.description = "select text within a cell (ala jupyter)"
key = "m c"
command = "jupyter.selectCell"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "between pair"
doc.combined.description = """
Select between pairs of the same N characters (t) or distinct sets of N
characters (s), where N is the count. Examples:
2mt'' would search for a string between `''` and `''`.
2ms,,.. would search for a string between `,,` and `..`.
"""
key = "m t"
command = "runCommands"
doc.combined.name = "between pair/two"
doc.combined.key = "t/s"
doc.description = """
Select between pairs of the same N characters, where N is the count.
Example: 2mt" would search for a string between " and ".
"""
[[bind.args.commands]]
command = "master-key.captureKeys"
args.acceptAfter = "{{max(key.count, 1)}}"
[[bind.args.commands]]
command = "selection-utilities.selectBetween"
args.str = "{{key.captured}}"
args.inclusive = false
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "between two"
doc.description = """
Select between two different sets of N characters, where N is the count e.g.
2ms,,.. would search for a string between ,, and ..
"""
key = "m s"
doc.combined.name = "between pair/two"
command = "runCommands"
[[bind.args.commands]]
command = "master-key.captureKeys"
args.acceptAfter = "{{2*(max(key.count, 1))}}"
[[bind.args.commands]]
command = "selection-utilities.selectBetween"
args.between.from = "{{key.captured.sub_string(0, key.captured.len()/2)}}"
args.between.to = "{{key.captured.sub_string(key.captured.len()/2)}}"
args.inclusive = false
## ### "Do" Actions
## These keys are all organized under the `space` key and they "do" something. These are generally more elaborate editing operations in the current editor pane.
[[bind]]
default = "{{bind.edit_action}}"
doc.name = "do"
key = "space"
doc.description = "additional actions, mostly for modifying specific syntactic formats"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = "paste after line"
doc.combined.name = "paste after/before line"
doc.combined.key = "p/shift+p"
doc.combined.description = "Paste text after/before current line"
doc.description = "Paste text after current line"
priority = 2
key = "space p"
command = "runCommands"
args.commands = [
{ command = "selection-utilities.appendToMemory", args.register = "myCommandRegister" },
"expandLineSelection",
"selection-utilities.activeAtEnd",
"selection-utilities.shrinkToActive",
"editor.action.clipboardPasteAction",
{ command = "selection-utilities.restoreAndClear", args.register = "myCommandRegister" },
"selection-utilities.restoreAndClear",
]
[[bind]]
default = "{{bind.edit_action}}"
priority = 2
doc.name = "paste before line"
doc.combined.name = "paste after/before line"
doc.description = "Paste text before current line"
key = "space shift+p"
command = "runCommands"
args.commands = [
{ command = "selection-utilities.appendToMemory", args.register = "myCommandRegister" },
"expandLineSelection",
"selection-utilities.activeAtStart",
"selection-utilities.shrinkToActive",
"editor.action.clipboardPasteAction",
{ command = "selection-utilities.restoreAndClear", args.register = "myCommandRegister" },
"selection-utilities.restoreAndClear",
]
[[bind]]
default = "{{bind.edit_action}}"
priority = 2
doc.name = "add line below"
doc.combined.name = "add line below/above"
doc.combined.description = "open a line below/above current line"
doc.combined.key = "o/shift+o"
doc.description = "open a line below current line"
key = "space o"
command = "editor.action.insertLineAfter"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = "add line above"
priority = 2
doc.combined.name = "add line below/above"
doc.description = "open a line above current line"
key = "space shift+o"
command = "editor.action.insertLineBefore"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'sym insert'
doc.description = "Insert a character pair around a character"
priority = 1
key = "space i"
doc.combined.name = "sym insert (mode)"
doc.combined.description = "Insert characters around pair (switching to syminsert mode until hitting again)"
doc.combined.key = "i/shift+i"
command = "runCommands"
[[bind.args.commands]]
command = "master-key.captureKeys"
args.acceptAfter = 1
[[bind.args.commands]]
command = "selection-utilities.insertAround"
args.before = '{{val.braces[key.captured]?.before ?? key.captured}}'
args.after = "{{val.braces[key.captured]?.after ?? key.captured}}"
args.followCursor = true
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'trim white'
doc.description = "Delete all external whitespace (left and right edges)"
key = "space [Minus]"
command = "selection-utilities.trimWhitespace"
[[bind]]
default = "{{bind.edit_action}}"
key = "space w"
doc.name = "wrap paragraph"
doc.combined.name = "wrap/join lines"
doc.description = "wrap paragraph text, preserving commenting"
doc.combined.description = "wrap paragraph text, preserving commenting / join lines together"
doc.combined.key = "w/j"
command = "rewrap.rewrapComment"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'join'
doc.combined.name = "wrap/join lines"
doc.description = "Remove newline between current and next line"
key = "space j"
mode = ["normal", "selectedit"]
when = "!editorHasSelection"
command = "runCommands"
args.commands = ["{{command.selectLinesDown}}", 'editor.action.joinLines']
[[bind]]
default = "{{bind.edit_action}}"
doc.combined.name = "wrap/join lines"
doc.name = 'join'
doc.description = "Remove newline between current and next line"
mode = ["normal", "selectedit"]
key = "space j"
command = "editor.action.joinLines"
[[bind]]
default = "{{bind.edit_action}}"
key = "space shift+f"
doc.name = "format selection"
doc.combined.name = "format document / selection"
command = "editor.action.formatSelection"
[[bind]]
default = "{{bind.edit_action}}"
key = "space shift+f"
doc.combined.name = "format document / selection"
doc.combined.key = "f/shift+f"
doc.combined.description = "Format document / selection"
doc.name = "format selection"
doc.description = "Format sel"
when = "master-key.count >= 1"
command = "runCommands"
args.commands = [
"{{command.selectLinesDown}}",
"editor.action.formatSelection",
"selection-utilities.shrinkToActive",
]
[[bind]]
default = "{{bind.edit_action}}"
key = "space f"
doc.name = "format doc"
doc.combined.name = "format document / selection"
command = "editor.action.formatDocument"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'parens (prefix)'
doc.description = "actions related to various brackets (`[`, `(`, `{`)"
key = "space 4"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'assistant'
doc.description = """
Use Vim Sandwich to add, delete, and replace surroundings like quotes (single ', double ", backtick `), brackets (parentheses (), braces {}, square brackets [], angle brackets <>), and HTML/XML tags.
"""
key = "space 4 a"
command = "vscode-sandwich.execute"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'remove'
doc.description = "Removes surrounding pairs"
key = "space 4 d"
command = "bracketeer.removeBrackets"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'swap'
doc.description = "Swap between `[`, `(` and `{`"
key = "space 4 s"
command = "bracketeer.swapBrackets"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'quotes (prefix)'
doc.description = "Actions related to quotes"
doc.combined.key = "\""
key = "space [Period]"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'remove'
doc.description = "Removes quotes (', \" or `)"
key = "space [Period] d"
command = "bracketeer.removeQuotes"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'swap'
doc.description = "Swap quotes (', \" or `)"
key = "space [Period] s"
command = "bracketeer.swapQuotes"
[[bind]]
default = "{{bind.edit_action}}"
key = "space a"
doc.combined.name = "(block) comment"
command = "editor.action.commentLine"
[[bind]]
args.commands = ["{{command.selectLinesDown}}", "editor.action.commentLine"]
default = "{{bind.edit_action}}"
key = "space a"
doc.name = "comment lines"
doc.combined.name = "(block) comment"
doc.combined.description = "Toggle (block) comment"
doc.combined.key = "(shift+) a"
doc.description = "select next comment"
when = "master-key.count >= 1"
command = "runCommands"
[[bind]]
default = "{{bind.edit_action}}"
key = "space shift+a"
doc.combined.name = "(block) comment"
command = "editor.action.blockComment"
[[bind]]
default = "{{bind.edit_action}}"
key = "space shift+a"
doc.name = "block comment lines"
doc.combined.name = "(block) comment"
doc.description = "select previous comment"
when = "master-key.count >= 1"
command = "runCommands"
args.commands = [
"{{command.selectLinesDown}}",
"editor.action.blockComment",
"selection-utilities.shrinkToActive",
]
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'inc all #'
doc.combined.name = "inc/dec all #"
doc.combined.description = "Increment/decrement selected numbers; increment/decrement increases per selection"
doc.combined.key = "=/shift+="
doc.description = "Increment selected numbers; increment increases per selection"
key = "space ="
command = "selection-utilities.incrementNumberPerSelection"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'dec all #'
doc.combined.name = "inc/dec all #"
doc.description = "Decrement selected numbers; decrement increases per selection"
key = "space shift+="
command = "selection-utilities.decrementNumberPerSelection"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'notebook cell…'
doc.description = "Actions related to notebook cells"
key = "space c"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_action}}"
key = "space c i"
when = "editorLangId == 'quarto'"
command = "quarto.insertCodeCell"
doc.name = "insert cell"
doc.description = "insert a new cell in a notebook"
[[bind]]
default = "{{bind.edit_action}}"
key = "space c s"
when = "editorLangId != 'quarto'"
command = "jupyter.selectCell"
doc.name = "sel. cell"
doc.description = "select jupyter cell"
[[bind]]
default = "{{bind.edit_action}}"
key = "space [Comma]"
doc.name = 'sent. lines'
doc.description = "Split paragraph into one line per sentence"
doc.combined.key = "."
mode = "normal"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.moveBy"
args.unit = "paragraph"
args.boundary = "both"
args.selectWhole = true
[[bind.args.commands]]
command = "editor.action.joinLines"
[[bind.args.commands]]
command = "selection-utilities.createBy"
args.text = "."
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "cursorRight"
[[bind.args.commands]]
command = "type"
args.text = "\n"
[[bind.args.commands]]
command = "selection-utilities.cancelSelection"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'toggle check'
doc.description = "Toggle a markdown checkbox"
key = "shift+6"
command = "markdown-checkbox.markCheckbox"
## ### Macros
## These commands interact with the history of previously typed commands to repeat some sequence of commands. They can record any edits, and any commands that are issued through master key bindings. Commands that are not part of this binding file (e.g. a standard call to Cmd/Ctrl+V to paste) will not be recorded. You can copy your non-master-key bindings over to master key (so that they will be recorded) using `Import Default Bindings` and `Import User Bindings` to allow all of the default and user bindings stored in VSCode's normal keybinding files to be recorded by master key. (You will have to remove your original user bindings from the VSCode `keybinding.json` file manually)
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "record"
doc.description = "Start/stop recording Master Key commands"
key = "shift+q"
when = "!master-key.record"
command = "master-key.record"
args.on = true
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "record"
doc.description = """
Start/stop recording key presses defined by Master Key pushing it to the
top of the `history` stack once recording finishes."
"""
key = "shift+q"
when = "master-key.record"
command = "runCommands"
[[bind.args.commands]]
command = "master-key.record"
args.on = false
[[bind.args.commands]]
command = "master-key.pushHistoryToStack"
args.range.from = '{{last_history_index(|i| history[i-1]?.doc?.name == "record")}}'
args.range.to = '{{history.len()-1}}'
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "replay/store…"
doc.description = "Replay commands or store the N most recently run commands as a macro"
key = "q"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "replay"
key = "q q"
doc.description = """
Replay the Master Key command sequence at the top of the `history` stack. Specifying
a count requests the Nth most recent item on this stack.
"""
command = "master-key.replayFromStack"
args.index = "{{key.count}}"
[[bind]]
default = "{{bind.edit_action_history}}"
doc.name = "store last"
doc.description = """
Store the N most recently run commands as a macro, where N is the count (defaulting to 1).
"""
key = "q l"
command = "master-key.pushHistoryToStack"
args.range.from = "{{history.len()-max(key.count, 1)}}"
args.range.to = "{{history.len()-1}}"
## ### Number actions
## These commands modify or enter numbers in some way.
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'inc #'
doc.description = "Increment a number by 1"
key = "="
command = "selection-utilities.incrementNumber"
[[bind]]
default = "{{bind.edit_action}}"
doc.name = 'dec #'
doc.description = "Decrement a number by 1 "
key = "shift+="
command = "selection-utilities.decrementNumber"
## ### Capitalization
## These modify the capitalization of letters in some way.
[[define.bind]]
id = "edit_action_capitals"
default = "{{bind.edit_action}}"
mode = ["normal", "selectedit"]
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = "capitalization…"
key = "1"
doc.description = "These modify the capitalization of selected letters in some way."
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'camel'
doc.description = "Swap style to lower camel case (`camelCase`)"
key = "1 c"
command = "extension.changeCase.camel"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'constant'
doc.description = "Swap style to constant (`IS_CONSTANT`)"
key = "1 shift+u"
command = "extension.changeCase.constant"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'dot'
doc.description = "Swap style to dot case (`dot.case`)"
key = "1 ."
command = "extension.changeCase.dot"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'kebab'
doc.description = "Swap style to kebab case (`kebab-case`)"
key = "1 [Minus]"
command = "extension.changeCase.kebab"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'all lower'
doc.description = "Swap all to lower case"
key = "1 shift+l"
command = "extension.changeCase.lower"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'first lower'
doc.description = "Swap first letter to lower case"
key = "1 l"
command = "extension.changeCase.lowerFirst"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'spaces'
doc.description = "Swap to spaces (`camelCase` -> `camel case`)"
key = "1 space"
command = "extension.changeCase.no"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'Camel'
doc.description = "Swap to upper camel case (`CamelCase`)"
key = "1 shift+c"
command = "extension.changeCase.pascal"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'path'
doc.description = "Swap to 'path' case (`path/case`)"
key = "1 [Delete]"
command = "extension.changeCase.path"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'snake'
doc.description = "Swap to snake case (`snake_case`)"
key = "1 8"
command = "extension.changeCase.snake"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'swap'
doc.description = "Swap upper and lower case letters"
key = "1 s"
command = "extension.changeCase.swap"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'title'
doc.description = "Swap to title case (all words have first upper case letter)"
key = "1 t"
command = "extension.changeCase.title"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'all upper'
doc.description = "Swap to use all upper case letters"
key = "1 shift+y"
command = "extension.changeCase.upper"
[[bind]]
default = "{{bind.edit_action_capitals}}"
doc.name = 'first upper'
doc.description = "Swap first character to upper case"
key = "1 u"
command = "extension.changeCase.upperFirst"
## ## Utility Commands
[[define.bind]]
id = "util"
when = "editorTextFocus && !findWidgetVisible"
[[bind]]
default = "{{bind.util}}"
doc.name = "utility…"
key = "tab"
doc.description = "utility related commands: file opening, window manipulation, debugging etc..."
command = "master-key.prefix"
## ### Miscellaneous
## These miscellaneous utility commands are all organized uner the prefix `tab`.
[[bind]]
default = "{{bind.util}}"
doc.name = "open recent"
doc.description = "Open recent file"
key = "tab r"
command = "workbench.action.openRecent"
[[bind]]
default = "{{bind.util}}"
doc.name = "hover"
doc.description = "show the hover view"
doc.combined.name = "(debug) hover"
doc.combined.description = "show the (debug) hover view"
doc.combined.key = "(shift+)f"
key = "tab f"
command = "editor.action.showHover"
[[bind]]
default = "{{bind.util}}"
doc.name = "debug hover"
doc.combined.name = "(debug) hover"
doc.description = "show the debug hover view"
key = "tab shift+f"
command = "editor.debug.action.showDebugHover"
## ### Bookmarks
[[bind]]
default = "{{bind.util}}"
doc.name = "toggle mark"
doc.combined.name = "toggle mark / mark..."
doc.description = "toggle bookmark at given line"
doc.combined.description = """
toggle bookmark at given line / bookmark related commands
"""
key = "tab shift+m"
doc.combined.key = "shift+m / m"
command = "vsc-labeled-bookmarks.toggleBookmark"
[[bind]]
default = "{{bind.util}}"
doc.name = "mark…"
doc.hideInPalette = false
doc.combined.name = "toggle mark / mark..."
doc.description = "bookmark related commands"
key = "tab m"
command = "master-key.prefix"
[[bind]]
default = "{{bind.util}}"
doc.name = "mark ↓"
doc.description = "move to next bookmark"
doc.combined.name = "mark ↓/↑"
doc.combined.description = """
Move to next/previous bookmark.
If selection is active, expand selection to next/previous bookmark instead.
"""
doc.combined.key = "j/k"
key = "tab m j"
when = "!master-key.val.select && !editorHasSelection"
command = "vsc-labeled-bookmarks.navigateToNextBookmark"
[[bind]]
default = "{{bind.util}}"
doc.combined.name = "mark ↓/↑"
doc.description = "expand selection to next bookmark"
key = "tab m j"
when = "master-key.val.select || editorHasSelection"
command = "vsc-labeled-bookmarks.expandSelectionToNextBookmark"
[[bind]]
default = "{{bind.util}}"
doc.name = "mark ↑"
doc.combined.name = "mark ↓/↑"
doc.description = "move to previous bookmark"
key = "tab m k"
when = "!master-key.val.select && !editorHasSelection"
command = "vsc-labeled-bookmarks.navigateToPreviousBookmark"
[[bind]]
default = "{{bind.util}}"
doc.name = "mark ↑"
doc.combined.name = "mark ↓/↑"
doc.hideInPalette = false
doc.description = "expand selection to previous bookmark"
key = "tab m k"
when = "master-key.val.select || editorHasSelection"
command = "runCommands"
args.commands = [
"vsc-labeled-bookmarks.expandSelectionToPreviousBookmark",
"selection-utilities.activeAtStart",
]
[[bind]]
default = "{{bind.util}}"
doc.name = "remove mark"
doc.description = "remove bookmark(s) (use quick selection)"
key = "tab m d"
command = "vsc-labeled-bookmarks.deleteBookmark"
[[bind]]
default = "{{bind.util}}"
doc.name = "toggle labeled mark"
doc.description = "toggle labeled bookmark at given line"
key = "tab m l"
command = "vsc-labeled-bookmarks.toggleLabeledBookmark"
[[bind]]
default = "{{bind.util}}"
doc.name = "nav marks"
doc.description = "reveal quick selection to move to a bookmark"
key = "tab m t"
command = "vsc-labeled-bookmarks.navigateToBookmark"
[[bind]]
default = "{{bind.util}}"
doc.name = "all commands"
doc.description = "show all bookmark commands in command palette"
key = "tab m p"
command = "workbench.action.quickOpen"
args = ">bookmarks"
## ### Motion Commands
[[bind]]
default = "{{bind.util}}"
doc.name = "error →"
doc.combined.name = "error →/←"
doc.combined.description = "move to next/previous error"
doc.combined.key = "e/shift+e"
doc.description = """
move to next error
"""
key = "tab e"
command = "editor.action.marker.next"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "error ←"
doc.combined.name = "error →/←"
doc.description = """
move to previous error
"""
key = "tab shift+e"
command = "editor.action.marker.prev"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "diff →"
doc.combined.name = "diff →/←"
doc.combined.description = "move to and show next/previous diff"
doc.combined.key = "c/shift+c"
doc.description = """
move to and show next diff
"""
key = "tab c"
command = "editor.action.dirtydiff.next"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "diff ←"
doc.combined.name = "diff →/←"
doc.description = """
move to and show previous diff
"""
key = "tab shift+c"
command = "editor.action.dirtydiff.previous"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "change →"
doc.combined.name = "change →/←"
doc.combined.description = "move to next/previous file change"
doc.combined.key = "d/shift+d"
doc.description = """
move to next file change
"""
key = "tab d"
command = "workbench.action.editor.nextChange"
[[bind]]
default = "{{bind.edit_motion}}"
doc.name = "change ←"
doc.combined.name = "change →/←"
doc.description = """
move to previous change
"""
key = "tab shift+d"
command = "workbench.action.editor.previousChange"
## ### Open Settings
[[bind]]
default = "{{bind.util}}"
doc.name = "settings…"
key = "tab s"
doc.description = "settings related commands"
command = "master-key.prefix"
[[bind]]
default = "{{bind.util}}"
doc.name = "settings UI"
doc.description = "Open the settings UI"
key = "tab s u"
command = "workbench.action.openGlobalSettings"
[[bind]]
default = "{{bind.util}}"
doc.name = "settings JSON"
doc.description = "Open the settings JSON file"
key = "tab s j"
command = "workbench.action.openSettingsJson"
[[bind]]
default = "{{bind.util}}"
doc.name = "keybindings UI"
doc.description = "Open the keybindings UI"
key = "tab s k"
command = "workbench.action.openGlobalKeybindings"
[[bind]]
default = "{{bind.util}}"
doc.name = "keybindings JSON"
doc.description = "Open the keybindings JSON file"
key = "tab s shift+k"
command = "workbench.action.openGlobalKeybindingsFile"
## ### Git Commands
[[bind]]
default = "{{bind.util}}"
doc.name = "git..."
doc.description = "git commands"
key = "tab g"
command = "master-key.prefix"
[[bind]]
default = "{{bind.util}}"
doc.name = "pull"
doc.description = "pull changes from remote"
doc.combined.description = "pull from/push to remote"
key = "tab g p"
command = "git.pull"
[[bind]]
default = "{{bind.util}}"
doc.name = "push"
doc.description = "push changes to remote"
key = "tab g shift+p"
command = "git.push"
[[bind]]
default = "{{bind.util}}"
doc.name = "checkout"
doc.combined.name = "commit/checkout"
doc.description = "commit changes"
doc.combined.description = "commit/checkout git changes"
doc.combined.key = "c/shift+c"
key = "tab g c"
command = "git.commit"
[[bind]]
default = "{{bind.util}}"
doc.name = "checkout"
doc.combined.name = "commit/checkout"
doc.description = "checkout changes"
key = "tab g shift+c"
command = "git.checkout"
[[bind]]
default = "{{bind.util}}"
doc.name = "revert range"
doc.description = "revert unstaged changes in selected range"
key = "tab g r"
command = "git.revertSelectedRanges"
[[bind]]
default = "{{bind.util}}"
doc.name = "stage range"
doc.description = "stage changes in selected range"
key = "tab g s"
command = "git.stageSelectedRanges"
[[bind]]
default = "{{bind.util}}"
doc.name = "commands..."
doc.description = "show GitLens command palette for git"
key = "tab g g"
command = "gitlens.gitCommands"
## ### Window Manipulation
## These are commands that interact with VSCode's user-interface in some way, rather than editing or moving around in the editor pane.
[[define.bind]]
id = "window"
doc.kind = "util"
mode = "normal"
when = "editorTextFocus && !findWidgetVisible"
[[bind]]
default = "{{bind.window}}"
doc.name = "center window"
doc.description = "center window at primary cursor position"
key = "tab tab"
command = "selection-utilities.revealActive"
args.at = "center"
[[bind]]
default = "{{bind.window}}"
doc.name = "window"
doc.description = "window/editor pane manipulation-related commands"
key = "tab w"
command = "master-key.prefix"
[[bind]]
default = "{{bind.window}}"
doc.name = "vert/horz"
key = "tab w r"
doc.description = "Toggle between horizontal and vertical layouts"
command = "workbench.action.toggleEditorGroupLayout"
[[bind]]
default = "{{bind.window}}"
doc.name = "next window/group"
doc.combined.name = "next/prev. window/group"
doc.description = "focus to next window/group"
doc.combined.description = "focus to next/prev window/group"
key = "tab l"
doc.combined.key = "h/l"
command = "workbench.action.focusNextGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "prev window/group"
doc.combined.name = "next/prev. window/group"
doc.description = "focus to previous window/group"
key = "tab h"
command = "workbench.action.focusPreviousGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "focus →"
doc.combined.name = "focus →/←"
doc.combined.description = "focus editor to group left/right"
doc.combined.key = "l/h"
doc.description = "focus editor to group to right"
key = "tab w l"
command = "workbench.action.focusRightGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "focus ←"
doc.combined.name = "focus →/←"
doc.combined.description = "focus editor to group left/right"
doc.combined.key = "l/h"
doc.description = "focus editor to group to left"
key = "tab w h"
command = "workbench.action.focusLeftGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "focus ↓"
doc.combined.name = "focus ↓/↑"
doc.combined.description = "focus editor to group above/below"
doc.combined.key = "j/k"
doc.description = "focus editor to group below"
key = "tab w j"
command = "workbench.action.focusBelowGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "focus ↑"
doc.combined.name = "focus ↓/↑"
doc.description = "focus editor to group above"
key = "tab w k"
command = "workbench.action.focusAboveGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "split editor..."
doc.description = "split editor to in a given direction"
key = "tab w s"
command = "master-key.prefix"
[[bind]]
default = "{{bind.window}}"
doc.name = "→"
doc.combined.name = "split →/←"
doc.combined.description = "split editor to group left/right"
doc.combined.key = "l/h"
doc.description = "split editor to group to right"
key = "tab w s l"
command = "workbench.action.splitEditorRight"
[[bind]]
default = "{{bind.window}}"
doc.name = "←"
doc.combined.name = "split →/←"
doc.description = "split editor to group to left"
key = "tab w s h"
command = "workbench.action.splitEditorLeft"
[[bind]]
default = "{{bind.window}}"
doc.name = "↓"
doc.combined.name = "split ↓/↑"
doc.combined.description = "split editor to group above/below"
doc.combined.key = "j/k"
doc.description = "split editor to group below"
key = "tab w s j"
command = "workbench.action.splitEditorDown"
[[bind]]
default = "{{bind.window}}"
doc.name = "↑"
doc.combined.name = "split ↓/↑"
doc.description = "split editor to group above"
key = "tab w s k"
command = "workbench.action.splitEditorUp"
[[bind]]
default = "{{bind.window}}"
doc.name = "move editor..."
doc.description = "move editor to in a given direction"
key = "tab w m"
command = "master-key.prefix"
[[bind]]
default = "{{bind.window}}"
doc.name = "→"
doc.combined.name = "move →/←"
doc.combined.description = "move editor to group left/right"
doc.combined.key = "l/h"
doc.description = "move editor to group to right"
key = "tab w m l"
command = "workbench.action.moveActiveEditorGroupRight"
[[bind]]
default = "{{bind.window}}"
doc.name = "←"
doc.combined.name = "move →/←"
doc.description = "move editor to group to left"
key = "tab w m h"
command = "workbench.action.moveActiveEditorGroupLeft"
[[bind]]
default = "{{bind.window}}"
doc.name = "↓"
doc.combined.name = "move ↓/↑"
doc.combined.description = "move editor to group above/below"
doc.combined.key = "j/k"
doc.description = "move editor to group below"
key = "tab w m j"
command = "workbench.action.moveActiveEditorGroupDown"
[[bind]]
default = "{{bind.window}}"
doc.name = "↑"
doc.combined.name = "move ↓/↑"
doc.description = "move editor to group above"
key = "tab w m k"
command = "workbench.action.moveActiveEditorGroupUp"
[[bind]]
default = "{{bind.window}}"
doc.name = "copy editor..."
doc.description = "copy editor to another group"
key = "tab w c"
command = "master-key.prefix"
[[bind]]
default = "{{bind.window}}"
doc.name = "→"
doc.combined.name = "copy →/←"
doc.combined.description = "copy editor to next/prev. group"
doc.combined.key = "l/h"
doc.description = "copy editor to next group"
key = "tab w c l"
command = "workbench.action.splitEditorToNextGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "←"
doc.combined.name = "copy →/←"
doc.description = "copy editor to previous group"
key = "tab w c h"
command = "workbench.action.splitEditorToPreviousGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "close group"
doc.description = "close the current group of editors"
key = "tab w x"
command = "workbench.action.closeEditorsInGroup"
[[bind]]
default = "{{bind.window}}"
doc.name = "max"
doc.description = "minimize size of all other groups"
key = "tab w shift+m"
command = "workbench.action.minimizeOtherEditors"
[[bind]]
default = "{{bind.window}}"
doc.name = "equal"
doc.description = "equalize size of all groups"
key = "tab w ="
command = "workbench.action.evenEditorWidths"
[[bind]]
default = "{{bind.window}}"
doc.name = "curs. win top"
doc.description = "center window so that primary cursor is at the top"
key = "tab k"
doc.combined.name = "center window top/bottom"
doc.combined.description = "center window so that primary cursor is at the top/bottom"
doc.combined.key = "k/j"
command = "selection-utilities.revealActive"
args.at = "top"
[[bind]]
default = "{{bind.window}}"
doc.name = "curs. win bottom"
doc.combined.name = "center window top/bottom"
doc.description = "center window so that primary cursor is at the bottom"
key = "tab j"
command = "selection-utilities.revealActive"
args.at = "bottom"
## ### Debugging Commands
## Commands for interacting with VSCode's debugger UI.
[[bind]]
default = "{{bind.util}}"
doc.name = "breakpt."
doc.combined.name = "breakpt / debug..."
doc.combined.key = "shift+b/b"
doc.description = "toggle debug breakpoint"
doc.combined.description = "toggle debug breakpoint / debug related commands..."
key = "tab shift+b"
command = "editor.debug.action.toggleBreakpoint"
[[bind]]
default = "{{bind.util}}"
doc.name = "debug..."
doc.combined.name = "breakpt / debug..."
doc.description = "assorted debugging actions"
key = "tab b"
command = "master-key.prefix"
[[bind]]
default = "{{bind.util}}"
doc.name = "cond. break"
doc.description = "conditional breakpoint"
key = "tab b shift+c"
command = "editor.debug.action.conditionalBreakpoint"
[[bind]]
default = "{{bind.util}}"
doc.name = "start"
doc.description = "start debugging"
key = "tab b r"
command = "workbench.action.debug.start"
[[bind]]
default = "{{bind.util}}"
doc.name = "continue"
doc.description = "continue debugging"
key = "tab b c"
command = "workbench.action.debug.continue"
[[bind]]
default = "{{bind.util}}"
doc.name = "next"
doc.description = "debug: step over next line"
key = "tab b j"
command = "workbench.action.debug.stepOver"
[[bind]]
default = "{{bind.util}}"
doc.name = "into"
doc.description = "debug: step into next line"
key = "tab b i"
command = "workbench.action.debug.stepInto"
[[bind]]
default = "{{bind.util}}"
doc.name = "out"
doc.description = "debug: step out"
key = "tab b o"
command = "workbench.action.debug.stepOut"
## ## Special Commands
## These commands apply in a narrower set of use cases, and will likely be used less frequently, but can add some very powerful tools to a typist's toolbox.
## ### Select-edit Mode
## Select-edit mode allows you make a variety of kakoune-like modifications of one or more cursors. This lends itself to work flows such as:
## - select every line of text as a separate cursor, then filter out the lines you don't want
## - split an array by comma delimiters and edit each element of the array.
## - save a single selection to a list of selections to use for later and
## then move the cursor to the next selection you wish to add
[[define.bind]]
id = "edit_select_edit"
mode = "selectedit"
doc.kind = "motion"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "select-edit"
doc.description = """
Enter a mode where you can edit and manipulate (possibly multiple) selections.
"""
key = "[Quote]"
command = "master-key.setMode"
args.value = "selectedit"
mode = "normal"
[[bind]]
default = "{{bind.edit_select_edit}}"
key = "shift+[Quote]"
doc.combined.name = "remove cursors"
doc.combined.key = "shift/ctrl+[Quote]"
doc.combined.description = "Delete all selections and return to normal (multiple key variants)"
doc.name = "del. cursors"
doc.description = "Delete all selections and return to normal"
command = "runCommands"
args.commands = [
"selection-utilities.cancelSelection",
"master-key.enterNormal",
]
mode = ["selectedit", "normal"]
[[bind]]
default = "{{bind.edit_select_edit}}"
key = "ctrl+[Quote]"
mode = ["insert", "selectedit", "normal"]
doc.name = "remove cursors"
doc.combined.name = "remove cursors"
doc.description = "Delete all selections and return to normal"
command = "runCommands"
args.commands = [
"selection-utilities.cancelSelection",
"master-key.enterNormal",
]
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = 'normal'
doc.description = "return to normal mode"
key = "[Quote]"
command = "master-key.enterNormal"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "add →"
doc.combined.name = "add →/←"
doc.description = "add cursor at the next match to the primary cursor's text"
doc.combined.description = "add cursor at the next/previous match to the primary cursor's text"
key = "l"
doc.combined.key = "l/h"
repeat = "{{key.count}}"
command = "selection-utilities.addNext"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "add ←"
doc.combined.name = "add →/←"
doc.description = "add cursor at the previous match to the primary cursor's text"
key = "h"
command = "selection-utilities.addPrev"
repeat = '{{key.count}}'
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "skip →"
doc.combined.name = "skip →/←"
doc.description = "move primary cursor to the next match of the primary cursor's text"
doc.combined.description = "move primary cursor to the next/previous match of the primary cursor's text"
key = "shift+l"
doc.combined.key = "shift+l/h"
command = "selection-utilities.skipNext"
repeat = "{{key.count}}"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "skip ←"
doc.combined.name = "skip →/←"
doc.description = "move primary cursor to the previous match of the primary cursor's text"
key = "shift+h"
command = "selection-utilities.skipPrev"
repeat = '{{key.count}}'
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "align ←"
doc.description = "align selections left"
key = "="
command = "selection-utilities.alignSelectionsLeft"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "align →"
doc.description = "align selections right"
key = "shift+="
command = "selection-utilities.alignSelectionsRight"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "→ sel"
doc.combined.name = "→/← sel"
doc.description = """
make the next selection primary; primary selections determine from where you add cursors,
what cursor you delete, and where the cursor goes when you clear or save selections
"""
doc.combined.description = """
make the next/previous selection primary; primary selections determine from where you add cursors,
what cursor you delete, and where the cursor goes when you clear or save selections
"""
key = "j"
doc.combined.key = "j/k"
command = "selection-utilities.movePrimaryRight"
repeat = '{{key.count}}'
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "← sel"
doc.combined.name = "→/← sel"
doc.description = "make the previous selection primary; primary selections determine from where you add cursors, what cursor you delete, and where the cursor goes when you clear or save selections"
key = "k"
command = "selection-utilities.movePrimaryLeft"
repeat = '{{key.count}}'
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "insert ↑"
doc.combined.name = "insert ↑/↓"
doc.description = """
insert cursor on line above
"""
doc.combined.description = "insert cursor on line above/below"
key = "shift+k"
doc.combined.key = "shift+k/j"
command = "editor.action.insertCursorAbove"
repeat = "{{key.count}}"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "insert ↓"
doc.combined.name = "insert ↑/↓"
doc.description = """
insert cursor on line below
"""
key = "shift+j"
command = "editor.action.insertCursorBelow"
repeat = "{{max(key.count, 1)-1}}"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "del. primary"
doc.combined.name = "del. primary/others"
doc.description = "remove the primary selection"
doc.combined.key = "d/shift+d"
doc.combined.description = """
Remove either the primary selection or all selections.
"""
key = "d"
command = "selection-utilities.deletePrimary"
repeat = "{{max(key.count, 1)-1}}"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = 'del. others'
doc.description = "delete all other cursors but the primary selection"
doc.combined.name = "del. primary/others"
key = "shift+d"
command = "removeSecondaryCursors"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "save sel"
doc.description = """
save all selections to the default register and returne to normal mode.
Use a count to specify an alternate register
"""
key = "c"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.appendToMemory"
args.register = '{{if key.count > 0 { key.count } else { "default" } }}'
[[bind.args.commands]]
command = "selection-utilities.shrinkToActive"
[[bind.args.commands]]
command = "master-key.enterNormal"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "load sel"
doc.description = """
load previously saved selections in the default register.
Use a count to specify an alternate register
"""
key = "v"
command = "selection-utilities.restoreAndClear"
args.register = '{{if key.count > 0 { key.count } else { "default" } }}'
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "exchange sel"
doc.description = """
With no saved selection, saves the selection. With saved selections
exchanges text of current selections with those of the saved selections (number of selections must match). Use a count to specify an alternate register.
"""
key = "x"
command = "runCommands"
[[bind.args.commands]]
command = "selection-utilities.swapWithMemory"
args.register = '{{if key.count > 0 { key.count } else { "default" } }}'
[[bind.args.commands]]
command = "master-key.enterNormal"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "rem saved sel"
doc.description = """
remove the most recently saved selection from the list of saved selections
"""
command = "runCommands"
key = "n"
[[bind.args.commands]]
command = "selection-utilities.deleteLastSaved"
args.register = '{{if key.count > 0 { key.count } else { "default" } }}'
[[bind.args.commands]]
command = "master-key.enterNormal"
[[bind]]
default = "{{bind.edit_select_edit}}"
key = "shift+enter"
doc.name = "split sel"
doc.description = """
Split selection into multiple selections by new line characters. This is useful for splitting a selection of text into multiple selections, one for each line of text.
"""
command = "selection-utilities.splitByNewline"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "sel. all matches"
doc.description = """
create a selection for every match of the current word (or selection)
"""
key = "shift+8"
command = "editor.action.selectHighlights"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "character"
doc.description = "If selection, create cursors at each given character to split the selection."
key = "s"
command = "runCommands"
[[bind.args.commands]]
command = "master-key.captureKeys"
args.acceptAfter = 1
[[bind.args.commands]]
command = "selection-utilities.splitBy"
args.text = "{{key.captured}}"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "string"
doc.description = "If selection, create cursors at each given string to split the selection."
key = "shift+s"
command = "selection-utilities.splitBy"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "include"
doc.combined.key = "f/shift+f"
doc.combined.name = "include/exclude"
doc.combined.description = "Include or exclude all selections that contain a given string"
doc.description = """
Include all selections that contain a given string
"""
key = "f"
command = "selection-utilities.includeBy"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.combined.name = "include/exclude"
doc.name = "exclude"
doc.description = """
Exclude all selections that contain a given string
"""
key = "shift+f"
command = "selection-utilities.excludeBy"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "create"
doc.description = "create selections of given string scoped to the current selections"
key = "[Delete]"
command = "selection-utilities.createBy"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "regex"
doc.description = "operations by regex rather than string"
key = "r"
command = "master-key.prefix"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "split"
doc.description = "split by a given regular expression"
key = "r shift+s"
command = "selection-utilities.splitByRegex"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "create"
doc.description = "create selections of given regular expression scoped to the current selections"
key = "r [Delete]"
command = "selection-utilities.createByRegex"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "include"
doc.description = "Include all selections that contain a given regular expression"
key = "r f"
command = "selection-utilities.includeByRegex"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "exclude"
doc.description = "Exclude all selections that contain a given regular expression"
key = "r shift+f"
command = "selection-utilities.excludeByRegex"
[[bind]]
default = "{{bind.edit_select_edit}}"
key = "o"
doc.name = "move cursor in sel →"
doc.combined.key = "o/shift+o"
doc.combined.name = "move cursor in sel →/←"
doc.combined.description = "move cursor to start/end of selection"
doc.description = "move cursor to start of selection"
command = "selection-utilities.activeAtEnd"
[[bind]]
default = "{{bind.edit_select_edit}}"
doc.name = "move cursor in sel ←"
doc.combined.name = "move cursor in sel →/←"
doc.description = "move cursor to back of selection"
key = "shift+o"
command = "selection-utilities.activeAtStart"
## ### Symmetric Insert Mode
## Symmetric insert mode allows you to edit text at both the start and the beginning of a selection. When entering a character with a complimentary pair (e.g. `(` to `)`) entry is handled in the expected way. For example if you type `(` at the start of a selection while in symmetric insert mode, `)` will apepar at the end of the selection.
## As a general rule, the letter keys issue commands of various sorts, and the other keys can be used to enter text (since we rarley want to surround a selection with an `a` but might want to surround it with `*` or `/`.
[[define.val]]
[define.val.braces]
"{".before = "{"
"{".after = "}"
"}".before = "{"
"}".after = "}"
"[".before = "["
"[".after = "]"
"]".before = "["
"]".after = "]"
"(".before = "("
"(".after = ")"
")".before = "("
")".after = ")"
"<".before = "<"
"<".after = ">"
">".before = "<"
">".after = ">"
[[mode]]
name = "syminsert"
highlight = "Highlight"
cursorShape = "BlockOutline"
[[mode.whenNoBinding.run]]
command = "selection-utilities.insertAround"
args.before = '{{val.braces[key.captured]?.before ?? key.captured}}'
args.after = "{{val.braces[key.captured]?.after ?? key.captured}}"
args.followCursor = true
[[define.bind]]
id = "edit_action_symmetric"
doc.kind = "action"
mode = "syminsert"
[[define.bind]]
id = "edit_motion_symmetric"
doc.kind = "motion"
mode = "syminsert"
[[bind]]
default = "{{bind.edit_action_symmetric}}"
doc.name = "sym insert mode"
priority = 1
doc.description = """
In this mode all commands and character insertions happen at both ends of
the selection
"""
mode = "normal"
key = "space shift+i"
doc.combined.name = "sym insert (mode)"
command = "master-key.setMode"
args.value = "syminsert"
[[bind]]
default = "{{bind.edit_action_symmetric}}"
doc.name = "Normal"
doc.description = "Return to normal model"
key = "enter"
command = "master-key.setMode"
mode = "syminsert"
[[bind]]
doc.name = "esc. char"
default = "{{bind.edit_action_symmetric}}"
key = '\'
doc.description = """
Insert escaped character before braces you enter to surround the selection (e.g. `\\{` or `\\}`)
"""
command = "runCommands"
[[bind.args.commands]]
command = "master-key.captureKeys"
args.acceptAfter = 1
[[bind.args.commands]]
command = "selection-utilities.insertAround"
args.before = "{{'\\\\' + (val.braces[key.captured]?.before ?? key.captured)}}"
args.after = "{{'\\\\' + (val.braces[key.captured]?.after ?? key.captured)}}"
args.followCursor = true
[[bind]]
default = "{{bind.edit_action_symmetric}}"
doc.name = "delete"
key = "x"
doc.description = """
delete the first and last adjacent character when cursor is at end of selection and
delete the first and last character *in* the selection when cursor is at the start of the
selection
"""
command = "selection-utilities.deleteAround"
args.count = "{{key.count}}"
args.followCursor = true
[[bind]]
default = "{{bind.edit_motion_symmetric}}"
key = "l"
doc.name = "shrink/grow selection →/←"
doc.combined.key = "l/h"
doc.combined.name = "shrink/grow selection →/←"
doc.combined.description = "shrink/grow selections inwards or outwards depending on if the cursor is at the start or end of the selection"
doc.description = "shrink selection if cursor is at start of selection, grow selection if cursor is at end of selection"
command = "selection-utilities.adjustSelections"
args.dir = "forward"
args.count = "{{key.count}}"
[[bind]]
default = "{{bind.edit_motion_symmetric}}"
key = "h"
doc.name = "shrink/grow selection →/←"
doc.combined.name = "shrink/grow selection →/←"
doc.description = "shrink selection if cursor is at end of selection, grow selection if cursor is at start of selection"
command = "selection-utilities.adjustSelections"
args.dir = "backward"
args.count = "{{key.count}}"
[[bind]]
default = "{{bind.edit_motion_symmetric}}"
key = "o"
doc.name = "move cursor in sel →"
doc.combined.key = "o/shift+o"
doc.combined.name = "move cursor in sel →/←"
doc.combined.description = "move cursor to start/end of selection"
doc.description = "move cursor to start of selection"
command = "selection-utilities.activeAtEnd"
[[bind]]
default = "{{bind.edit_motion_symmetric}}"
doc.name = "move cursor in sel ←"
doc.combined.name = "move cursor in sel →/←"
doc.description = "move cursor to back of selection"
key = "shift+o"
command = "selection-utilities.activeAtStart"
[[bind]]
default = "{{bind.edit_action_symmetric}}"
key = "u"
doc.name = "undo"
doc.description = "undo last change"
doc.combined.name = "undo/redo"
doc.combined.key = "u/shift+u"
doc.combined.description = "undo/redo last change"
command = "undo"
[[bind]]
default = "{{bind.edit_action_symmetric}}"
key = "shift+u"
doc.name = "redo"
doc.description = "redo last change"
doc.combined.name = "undo/redo"
command = "redo"
[[bind]]
default = "{{bind.edit_motion_symmetric}}"
key = "v"
doc.name = "deselect"
doc.description = """
reduce all selections to length zero and return to normal mode
"""
command = "runCommands"
args.commands = [
"selection-utilities.shrinkToActive",
{ command = "master-key.setValue", args = { name = "select", value = false } },
"master-key.enterNormal",
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment