Skip to content

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 w will 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:

keynamedescriptionmode
suggestshow 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 docsShow text documentation for keybindingsnormal
visual docShow visual documentation for keybindingsnormal

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.

keynamedescriptionmode
normalEnter normal modesyminsert, selectedit, normal, insert, capture

Simple motions

These are the simplest motions that can be performed in Larkin.

keynamedescriptionmode
←/→move left/rightnormal
↓/↑move down/upnormal
start/endmove to start/end of linenormal
sel ↑/↓select lines up/downnormal

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.

keynamedescriptionmode
count 0-9Add digit 0-9 to count argument of a commandsyminsert, 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.

keynamedescriptionmode
insertInsert mode before cursornormal, selectedit, syminsert
appendInsert mode after cursornormal, selectedit, syminsert
changeWithout 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
deleteWithout a count: delete selected text (and store to clipboard). With a count, delete up to the next `count` lines and store to clipboard.normal
copycopy selected text to clipboardnormal
paste before/after/inPaste clipboard before/after/at the cursor/selectionnormal
delete charnormal

Repeating Motions and Actions

There are a few ways to make repetitive motions and actions easier.

keynamedescriptionmode
repeat motionRepeat the last motion command. Motions usually move the cursor or change the selection.normal
repeat subjectRepeat 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 actionRepeat 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 commandRepeat 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.

keynamedescriptionmode
pg ↓/↑select down/up, relative to page sizenormal, insert
exapandexpand selections to full linesnormal
subwrd ←/→next/prev subword (camel/snake case)normal
word ←/→next/prev wordnormal
subwrd endnext subword (camel/snake case) endnormal
word endnext word endnormal
paragraph →/←next/previous paragraphnormal
subsec →/←next/previous subsectionnormal
shrink/hold selectionreduce selections to zero length / make all commands extend the selectionnormal
open below/above, act →/←without selection: open a line below/above current line and enter insert, with selection: move cursor to end/start of selectionnormal
to bracketMove to matching bracketnormal
→ (←) selselect *just* the character to the right (left)normal, selectedit
allSelect entire documentnormal
trim whttrim external whitespacenormal
→/← num.Move to next/prev numbernormal
narrow to subwordNarrow 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.

keynamedescriptionmode
insert startInsert at start of linenormal, selectedit, syminsert
insert endInsert at end of linenormal, selectedit, syminsert
change to/backWithout a count: change from current char to end of line. With a count: change the previous `count` lines.normal
del. towithout count: Delete from cursor to end of line; with count: Delete from current line up `count` number of keys.normal
replace charreplace the character under the cursornormal
insert charinsert a character in front of the cursornormal, selectedit
undonormal
redonormal
copy (eol/up)without a count: copy to end of line; with a count: copy this and the previous N linesnormal
indentIndent linesnormal
deindentDe-indent linesnormal

Motion History

These commands interact with the history of cursor motions and selections moving backwards from the current state or reversing this backwards motion.

keynamedescriptionmode
cursor undo/redonormal
nav ←/→Go back/forward in navigation historynormal
edit ←/→Go back/forward in edit historynormal

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

keynamedescriptionmode
search → (←)search forwards (backwards)normal
→ searchGo to the next match of the search querynormal
← searchGo to the previous match of the search querynormal
match →/←Next/previous match to object under cursornormal
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 pairnormal

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.

keynamedescriptionmode
gotoGoto 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 linesnormal
unwrp sel ↑/↓select unwrapped lines up/downnormal
doc top/bottomselect to top/bottom of documentnormal
doc startselect to start (line) of document.normal
WORD →/←next/prev WORD; e.g. contiguous non-whitespace regionnormal
WORD end →next WORD end; i.e. contiguous non-whitespace regionnormal
sec →/←next/previous sectionnormal
goto linegoto line commandnormal
to refsjump to a location where this symbol is referencednormal
go to (aside)go to the definition of symbol (in an editor to the side)normal
openopen the file name under the cursornormal
cell →/←previous jupyter notebook cellnormal

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 _)

keynamedescriptionmode
matchFind the closest character range matching a specified object.normal
smart expandUse VSCode's built-in smart expansion commandnormal
around subwrd ←/→(camel/snake case)normal
around word →/←normal
in → subword/wordnormal
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 regionnormal
in WORDselect within a WORD; a contiguous non-whitespace regionnormal
in/arnd parensexpand inside/around parens/brackets/braces and their contents; repeated calls to this command will seek out larger and larger scopesnormal
in/arnd quotesselect within/around current quotes; repeated calls to this command will seek out larger and larger scopesnormal
in <> / in ><text inside angle brackets / pairsnormal
in/arndall text at the same indentation level / all indentation along with the line above and below this (ala c-like syntax)normal
in cellselect text within a cell (ala jupyter)normal
between pair/twoSelect 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.

keynamedescriptionmode
doadditional actions, mostly for modifying specific syntactic formatsnormal
paste after/before linePaste text after/before current linenormal
add line below/aboveopen a line below/above current linenormal
sym insertInsert a character pair around a characternormal
trim whiteDelete all external whitespace (left and right edges)normal
wrap/join lineswrap paragraph text, preserving commenting / join lines togethernormal
format / format documentFormat selection / documentnormal
parensactions related to various brackets (`[`, `(`, `{`)normal
removeRemoves surrounding pairsnormal
parens/bracketsSwap between `[`, `(` and `{`normal
quotesActions related to quotesnormal
swapSwap quotes (', " or `)normal
(block) commentToggle (block) commentnormal
inc/dec all #Increment/decrement selected numbers; increment/decrement increases per selectionnormal
nb cellActions related to notebook cellsnormal
insert cellinsert a new cell in a notebooknormal
sel. cellselect jupyter cellnormal
sent. linesSplit paragraph into one line per sentencenormal
toggle checkToggle a markdown checkboxnormal

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)

keynamedescriptionmode
recordStart/stop recording Master Key commandsnormal
replayReplay 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 lastStore 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.

keynamedescriptionmode
inc #Increment a number by 1normal
dec #Decrement a number by 1normal

Captilization

These modify the capitalization of letters in some way.

keynamedescriptionmode
camelSwap style to lower camel case (`camelCase`)normal, selectedit
constantSwap style to constant (`IS_CONSTANT`)normal, selectedit
dotSwap style to dot case (`dot.case`)normal, selectedit
kebabSwap style to kebab case (`kebab-case`)normal, selectedit
all lowerSwap all to lower casenormal, selectedit
first lowerSwap first letter to lower casenormal, selectedit
spacesSwap to spaces (`camelCase` -> `camel case`)normal, selectedit
CamelSwap to upper camel case (`CamelCase`)normal, selectedit
pathSwap to 'path' case (`path/case`)normal, selectedit
snakeSwap to snake case (`snake_case`)normal, selectedit
swapSwap upper and lower case lettersnormal, selectedit
titleSwap to title case (all words have first upper case letter)normal, selectedit
all upperSwap to use all upper case lettersnormal, selectedit
first upperSwap first character to upper casenormal, selectedit

Utility Commands

These actions include miscellaneous utilities.

keynamedescriptionmode
paletteshow 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 commandsnormal
pullpull changes from remotenormal
pushpush changes to remotenormal
commit/checkoutcommit/checkout git changesnormal
revert rangerevert unstaged changes in selected rangenormal
commands...show GitLens command palette for gitnormal

Miscellaneous Commands

These miscellaneous utility commands are all organized uner the prefix tab.

keynamedescriptionmode
utilityutility related commands: file opening, window manipulation, debugging etc...normal
open recentOpen recent filenormal
(debug) hovershow the (debug) hover viewnormal
add mark / mark...toggle bookmark at given line / bookmark related commandsnormal
mark ↓/↑move to next/previous bookmarknormal
remove markremove bookmark (use quick selection)normal
nav marksreveal quick selection to move to a bookmarknormal
error →/←move to next/previous errornormal
diff →/←move to and show next/previous diffnormal
change →/←move to next/previous file changenormal

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.

keynamedescriptionmode
cntr wincenter window at primary cursor positionnormal
windowwindow/editor pane manipulation-related commandsnormal
vert/horzToggle between horizontal and vertical layoutsnormal
next/previous windowmove to next/prev windownormal
move →/←move editor to window left/rightnormal
move ↓/↑move editor to window above/belownormal
split editor...split editor to in a given directionnormal
split →/←move editor to window left/rightnormal
split ↓/↑split editor to window above/belownormal
close paneclose the given group of editorsnormal
maxminimize size of all other windowsnormal
equalequalize size of all windowsnormal
center window top/bottomcenter window so that primary cursor is at the top/bottomnormal

Debugging Commands

Commands for interacting with VSCode's debugger UI.

keynamedescriptionmode
breakpt / debug...toggle debug breakpoint / debug related commands...normal
cond. breakconditional breakpointnormal
startstart debuggingnormal
continuecontinue debuggingnormal
nextdebug: step over next linenormal
intodebug: step into next linenormal
outdebug: step outnormal

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
keynamedescriptionmode
select-editEnter a mode where you can edit and manipulate (possibly multiple) selections.normal
rm cursorsDelete all selections and return to normal (multiple key variants)selectedit, normal
normalreturn to normal modeselectedit
add →/←add cursor at the next/previous match to the primary cursor's textselectedit
skip →/←move primary cursor to the next/previous match of the primary cursor's textselectedit
align ←align selections leftselectedit
align →align selections rightselectedit
→/← selmake 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 selectionsselectedit
insert ↑/↓insert cursor on line above/belowselectedit
del. primaryremove the primary selectionselectedit
del. othersdelete all other cursors but the primary selectionselectedit
save selsave all selections to the default register. Use a count to specify an alternate registerselectedit
load selload previously saved selections in the default register. Use a count to specify an alternate registerselectedit
exchange selexchange 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 selremove the most recently saved selection from the list of saved selectionsselectedit
split selsplit selection into multiple selections by new line charactesrselectedit
sel allcreate a selection for every match of the current word (or selection)selectedit
charactersplit by a given characterselectedit
stringsplit by a given stringselectedit
includeInclude all selections that contain a given markerselectedit
excludeExclude all selections that contain a given markerselectedit
createcreate selections of given string scoped to the current selectionsselectedit
regexoperations by regex rather than stringselectedit
splitsplit by a given regular expressionselectedit
active to start/endmove cursor to start/end of selectionselectedit

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 /.

keynamedescriptionmode
sym insert modeIn this mode all commands and character insertions happen at both ends of the selectionnormal
NormalReturn to normal modelsyminsert
esc. charInsert escaped charactersyminsert
deletedelete 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 selectionsyminsert
sel →shrink/grow selections in direction that's rightwards from cursorsyminsert
sel ←shrink/grow selections in direction that's leftwards from cursorsyminsert
active to start/endmove cursor to start/end of selectionsyminsert
undosyminsert
redosyminsert
shrink selectionreduce all selections to length zero and return to normal modesyminsert