Larkin Keybindings
Larkin is the default keybinding set that ships with Master Key. 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
wwill be transformed to[KeyW], which corresponds to the location of the letter "W" in the U.S. Keyboard layout.
Getting Help
There are three kinds of help available in Master Key:
| key | name | description | mode |
|---|---|---|---|
| suggest | 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`. | syminsert, selectedit, normal | |
| text docs | Show text documentation for keybindings | normal | |
| visual doc | Show visual documentation for keybindings | normal |
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 for more ways to enter insert mode).
While in Normal model you will see a highlighted section with the text "normal" in the lower left hand corner of the status bar.
| key | name | description | mode |
|---|---|---|---|
| normal | Enter normal mode | syminsert, selectedit, normal, insert, capture |
Simple motions
These are the simplest motions that can be performed in Larkin.
| key | name | description | mode |
|---|---|---|---|
| ←/→ | move left/right | normal | |
| ↓/↑ | move down/up | normal | |
| start/end | move to start/end of line | normal | |
| sel ↑/↓ | select lines up/down | normal |
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.
| key | name | description | mode |
|---|---|---|---|
| count 0-9 | Add digit 0-9 to count argument of a command | syminsert, selectedit, normal |
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.
| key | name | description | mode |
|---|---|---|---|
| insert | Insert mode before cursor | normal, selectedit, syminsert | |
| append | Insert mode after cursor | normal, selectedit, syminsert | |
| change | Without a count: change selected region or all text from cursor to end of line if there is no selection. With a count: change up to `count` lines. | normal | |
| delete | Without a count: delete selected text (and store to clipboard). With a count, delete up to the next `count` lines and store to clipboard. | normal | |
| copy | copy selected text to clipboard | normal | |
| paste before/after/in | Paste clipboard before/after/at the cursor/selection | normal | |
| delete char | normal |
Repeating Motions and Actions
There are a few ways to make repetitive motions and actions easier.
| key | name | description | mode |
|---|---|---|---|
| repeat motion | Repeat the last motion command. Motions usually move the cursor or change the selection. | normal | |
| repeat subject | 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. | normal | |
| repeat action | 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). | normal | |
| repeat command | Repeat the last command, whatever it was. Also see `repeat action`. | normal |
Standard Motions
These are relatively common motions that compliment the 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.
| key | name | description | mode |
|---|---|---|---|
| pg ↓/↑ | select down/up, relative to page size | normal, insert | |
| exapand | expand selections to full lines | normal | |
| subwrd ←/→ | next/prev subword (camel/snake case) | normal | |
| word ←/→ | next/prev word | normal | |
| subwrd end | next subword (camel/snake case) end | normal | |
| word end | next word end | normal | |
| paragraph →/← | next/previous paragraph | normal | |
| subsec →/← | next/previous subsection | normal | |
| shrink/hold selection | reduce selections to zero length / make all commands extend the selection | normal | |
| open below/above, act →/← | without selection: open a line below/above current line and enter insert, with selection: move cursor to end/start of selection | normal | |
| to bracket | Move to matching bracket | normal | |
| → (←) sel | select *just* the character to the right (left) | normal, selectedit | |
| all | Select entire document | normal | |
| trim wht | trim external whitespace | normal | |
| →/← num. | Move to next/prev number | normal | |
| narrow to subword | Narrow current selection so it starts and stops at a subword (e.g. 'snake' in snake_case) | normal |
Standard Actions
These are the some common actions, that compliment the Simple Actions.
| key | name | description | mode |
|---|---|---|---|
| insert start | Insert at start of line | normal, selectedit, syminsert | |
| insert end | Insert at end of line | normal, selectedit, syminsert | |
| change to/back | Without a count: change from current char to end of line. With a count: change the previous `count` lines. | normal | |
| del. to | without count: Delete from cursor to end of line; with count: Delete from current line up `count` number of keys. | normal | |
| replace char | replace the character under the cursor | normal | |
| insert char | insert a character in front of the cursor | normal, selectedit | |
| undo | normal | ||
| redo | normal | ||
| copy (eol/up) | without a count: copy to end of line; with a count: copy this and the previous N lines | normal | |
| indent | Indent lines | normal | |
| deindent | De-indent lines | normal |
Motion History
These commands interact with the history of cursor motions and selections moving backwards from the current state or reversing this backwards motion.
| key | name | description | mode |
|---|---|---|---|
| cursor undo/redo | normal | ||
| nav ←/→ | Go back/forward in navigation history | normal | |
| edit ←/→ | Go back/forward in edit history | normal |
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
| key | name | description | mode |
|---|---|---|---|
| search → (←) | search forwards (backwards) | normal | |
| → search | Go to the next match of the search query | normal | |
| ← search | Go to the previous match of the search query | normal | |
| match →/← | Next/previous match to object under cursor | normal | |
| find char (back) | Find the next (previous) char (include char in selection) | normal | |
| to char (back) | Find the next/previous char (exclude char in selection) | normal | |
| char pair →/← | To next character pair | normal |
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.
| key | name | description | mode |
|---|---|---|---|
| goto | Goto commands move the location of the cursor (or the active selection position) forward or backwards in some direction. | normal | |
| unwrap ↓/↑ | 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 | normal | |
| unwrp sel ↑/↓ | select unwrapped lines up/down | normal | |
| doc top/bottom | select to top/bottom of document | normal | |
| doc start | select to start (line) of document. | normal | |
| WORD →/← | next/prev WORD; e.g. contiguous non-whitespace region | normal | |
| WORD end → | next WORD end; i.e. contiguous non-whitespace region | normal | |
| sec →/← | next/previous section | normal | |
| goto line | goto line command | normal | |
| to refs | jump to a location where this symbol is referenced | normal | |
| go to (aside) | go to the definition of symbol (in an editor to the side) | normal | |
| open | open the file name under the cursor | normal | |
| cell →/← | previous jupyter notebook cell | normal |
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 _)
| key | name | description | mode |
|---|---|---|---|
| match | Find the closest character range matching a specified object. | normal | |
| smart expand | Use VSCode's built-in smart expansion command | normal | |
| around subwrd ←/→ | (camel/snake case) | normal | |
| around word →/← | normal | ||
| in → subword/word | normal | ||
| in paragraph →/← | normal | ||
| around paragraph →/← | normal | ||
| around subsection →/← | normal | ||
| in subsection →/← | normal | ||
| other... | additional objects to match... | normal | |
| section →/← | normal | ||
| around WORD →/← | expand around a WORD; a contiguous non-whitespace region | normal | |
| in WORD | select within a WORD; a contiguous non-whitespace region | normal | |
| in/arnd parens | expand inside/around parens/brackets/braces and their contents; repeated calls to this command will seek out larger and larger scopes | normal | |
| in/arnd quotes | select within/around current quotes; repeated calls to this command will seek out larger and larger scopes | normal | |
| in <> / in >< | text inside angle brackets / pairs | normal | |
| in/arnd | all text at the same indentation level / all indentation along with the line above and below this (ala c-like syntax) | normal | |
| in cell | select text within a cell (ala jupyter) | normal | |
| between pair/two | 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 `..`. | normal |
"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.
| key | name | description | mode |
|---|---|---|---|
| do | additional actions, mostly for modifying specific syntactic formats | normal | |
| paste after/before line | Paste text after/before current line | normal | |
| add line below/above | open a line below/above current line | normal | |
| sym insert | Insert a character pair around a character | normal | |
| trim white | Delete all external whitespace (left and right edges) | normal | |
| wrap/join lines | wrap paragraph text, preserving commenting / join lines together | normal | |
| format / format document | Format selection / document | normal | |
| parens | actions related to various brackets (`[`, `(`, `{`) | normal | |
| remove | Removes surrounding pairs | normal | |
| parens/brackets | Swap between `[`, `(` and `{` | normal | |
| quotes | Actions related to quotes | normal | |
| swap | Swap quotes (', " or `) | normal | |
| (block) comment | Toggle (block) comment | normal | |
| inc/dec all # | Increment/decrement selected numbers; increment/decrement increases per selection | normal | |
| nb cell | Actions related to notebook cells | normal | |
| insert cell | insert a new cell in a notebook | normal | |
| sel. cell | select jupyter cell | normal | |
| sent. lines | Split paragraph into one line per sentence | normal | |
| toggle check | Toggle a markdown checkbox | normal |
Repeat actions
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)
| key | name | description | mode |
|---|---|---|---|
| record | Start/stop recording Master Key commands | normal | |
| replay | Replay the Master Key command sequence at the top of the `key.macro` stack. Specifying a count requests the Nth most recent item on this stack. | normal | |
| store last | Store the N most recently run commands as a macro, where N is the count (defaulting to 1). | normal |
Number actions
These commands modify or enter numbers in some way.
| key | name | description | mode |
|---|---|---|---|
| inc # | Increment a number by 1 | normal | |
| dec # | Decrement a number by 1 | normal |
Captilization
These modify the capitalization of letters in some way.
| key | name | description | mode |
|---|---|---|---|
| camel | Swap style to lower camel case (`camelCase`) | normal, selectedit | |
| constant | Swap style to constant (`IS_CONSTANT`) | normal, selectedit | |
| dot | Swap style to dot case (`dot.case`) | normal, selectedit | |
| kebab | Swap style to kebab case (`kebab-case`) | normal, selectedit | |
| all lower | Swap all to lower case | normal, selectedit | |
| first lower | Swap first letter to lower case | normal, selectedit | |
| spaces | Swap to spaces (`camelCase` -> `camel case`) | normal, selectedit | |
| Camel | Swap to upper camel case (`CamelCase`) | normal, selectedit | |
| path | Swap to 'path' case (`path/case`) | normal, selectedit | |
| snake | Swap to snake case (`snake_case`) | normal, selectedit | |
| swap | Swap upper and lower case letters | normal, selectedit | |
| title | Swap to title case (all words have first upper case letter) | normal, selectedit | |
| all upper | Swap to use all upper case letters | normal, selectedit | |
| first upper | Swap first character to upper case | normal, selectedit |
Utility Commands
These actions include miscellaneous utilities.
| key | name | description | mode |
|---|---|---|---|
| palette | show command suggestions within the context of the current mode and keybinding prefix (if any keys have already been typed) | syminsert, selectedit, normal, insert | |
| git... | git commands | normal | |
| pull | pull changes from remote | normal | |
| push | push changes to remote | normal | |
| commit/checkout | commit/checkout git changes | normal | |
| revert range | revert unstaged changes in selected range | normal | |
| commands... | show GitLens command palette for git | normal |
Miscellaneous Commands
These miscellaneous utility commands are all organized uner the prefix tab.
| key | name | description | mode |
|---|---|---|---|
| utility | utility related commands: file opening, window manipulation, debugging etc... | normal | |
| open recent | Open recent file | normal | |
| (debug) hover | show the (debug) hover view | normal | |
| add mark / mark... | toggle bookmark at given line / bookmark related commands | normal | |
| mark ↓/↑ | move to next/previous bookmark | normal | |
| remove mark | remove bookmark (use quick selection) | normal | |
| nav marks | reveal quick selection to move to a bookmark | normal | |
| error →/← | move to next/previous error | normal | |
| diff →/← | move to and show next/previous diff | normal | |
| change →/← | move to next/previous file change | normal |
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.
| key | name | description | mode |
|---|---|---|---|
| cntr win | center window at primary cursor position | normal | |
| window | window/editor pane manipulation-related commands | normal | |
| vert/horz | Toggle between horizontal and vertical layouts | normal | |
| next/previous window | move to next/prev window | normal | |
| move →/← | move editor to window left/right | normal | |
| move ↓/↑ | move editor to window above/below | normal | |
| split editor... | split editor to in a given direction | normal | |
| split →/← | move editor to window left/right | normal | |
| split ↓/↑ | split editor to window above/below | normal | |
| close pane | close the given group of editors | normal | |
| max | minimize size of all other windows | normal | |
| equal | equalize size of all windows | normal | |
| center window top/bottom | center window so that primary cursor is at the top/bottom | normal |
Debugging Commands
Commands for interacting with VSCode's debugger UI.
| key | name | description | mode |
|---|---|---|---|
| breakpt / debug... | toggle debug breakpoint / debug related commands... | normal | |
| cond. break | conditional breakpoint | normal | |
| start | start debugging | normal | |
| continue | continue debugging | normal | |
| next | debug: step over next line | normal | |
| into | debug: step into next line | normal | |
| out | debug: step out | normal |
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
| key | name | description | mode |
|---|---|---|---|
| select-edit | Enter a mode where you can edit and manipulate (possibly multiple) selections. | normal | |
| rm cursors | Delete all selections and return to normal (multiple key variants) | selectedit, normal | |
| normal | return to normal mode | selectedit | |
| add →/← | add cursor at the next/previous match to the primary cursor's text | selectedit | |
| skip →/← | move primary cursor to the next/previous match of the primary cursor's text | selectedit | |
| align ← | align selections left | selectedit | |
| align → | align selections right | selectedit | |
| →/← sel | 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 | selectedit | |
| insert ↑/↓ | insert cursor on line above/below | selectedit | |
| del. primary | remove the primary selection | selectedit | |
| del. others | delete all other cursors but the primary selection | selectedit | |
| save sel | save all selections to the default register. Use a count to specify an alternate register | selectedit | |
| load sel | load previously saved selections in the default register. Use a count to specify an alternate register | selectedit | |
| exchange sel | exchange selections: 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. | selectedit | |
| rem saved sel | remove the most recently saved selection from the list of saved selections | selectedit | |
| split sel | split selection into multiple selections by new line charactesr | selectedit | |
| sel all | create a selection for every match of the current word (or selection) | selectedit | |
| character | split by a given character | selectedit | |
| string | split by a given string | selectedit | |
| include | Include all selections that contain a given marker | selectedit | |
| exclude | Exclude all selections that contain a given marker | selectedit | |
| create | create selections of given string scoped to the current selections | selectedit | |
| regex | operations by regex rather than string | selectedit | |
| split | split by a given regular expression | selectedit | |
| active to start/end | move cursor to start/end of selection | selectedit |
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 /.
| key | name | description | mode |
|---|---|---|---|
| sym insert mode | In this mode all commands and character insertions happen at both ends of the selection | normal | |
| Normal | Return to normal model | syminsert | |
| esc. char | Insert escaped character | syminsert | |
| delete | 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 | syminsert | |
| sel → | shrink/grow selections in direction that's rightwards from cursor | syminsert | |
| sel ← | shrink/grow selections in direction that's leftwards from cursor | syminsert | |
| active to start/end | move cursor to start/end of selection | syminsert | |
| undo | syminsert | ||
| redo | syminsert | ||
| shrink selection | reduce all selections to length zero and return to normal mode | syminsert |
