Skip to content

Editor Commands ​

These are the editor commands built into HUME. A key runs them and a plugin reaches them with (call! …), but you can't run them by name at the : prompt. Other callables are documented elsewhere:

  • typed commands: Command mode
  • editor functions such as insert-key!, which only a script can call: Plugin API
  • a plugin's own commands: that plugin's documentation

For the keys that run these commands, see the key reference and the per-topic pages. A key marked (kitty) needs the kitty keyboard protocol; see Terminal compatibility.

Calling from Scheme ​

Scheme can call the commands on this page two ways:

scheme
;; directly, as a bare binding
(move-left pane)
;; or through the generic dispatcher, like a plugin command
(call! "move-left" pane)
  • The bare form works for the commands on this page except insert-register, which only call! and keys reach, and the two below.
  • call! works for any editor command, built in or defined by a script, except repeat-last-action and pipe. Those two run only from a key: calling them from Scheme raises an error.

Every command needs a pane that names a pane; a value with only a buffer (from (buffers), or a buffer-level hook) is refused. Most commands act on that pane even when it isn't focused, as long as it is still open and still shows the same buffer. These need the focused pane:

  • entering or leaving Insert mode, including change, open-line-above/open-line-below and completion-trigger
  • command-mode
  • toggling or leaving Extend mode (toggle-extend, collapse-and-exit-extend, collapse-to-anchor-and-exit-extend)
  • paste and paste cycling
  • repeat-last-action
  • switching or opening tabs
  • every pane focus, split, close and rotate command

A pane the command can't act on raises an error; the command never falls back to whatever is focused. See Calling other commands for how a plugin uses these.

Some commands also take a value that a key press asks for. From a script, that value is an argument, as each entry says:

  • a character: find-forward, find-backward, till-forward, till-backward, replace and surround-add
  • a pattern: search-forward, search-backward and sift-within

Motions ​

Move the cursor or selection.

CommandDefault keyEffect
find-backwardF + charFind previous occurrence of a character (inclusive, backward). From call!, pass the character as an argument.
find-forwardf + charFind next occurrence of a character (inclusive, forward). From call!, pass the character as an argument.
goto-first-lineg gMove cursors to the first character of the buffer.
goto-first-nonblankg sMove cursors to the first non-blank character on the line.
goto-last-lineg eMove cursors to the first character of the last line.
goto-line-endEnd / g lMove cursors to the last character on the line, or past it in Insert mode.
goto-line-startHome / g hMove cursors to the start of the line.
goto-matching-pair#Move cursors to the matching bracket or tag.
goto-next-argumentg aSelect the next argument.
goto-next-classg tSelect the next class or type.
goto-next-commentg cSelect the next comment.
goto-next-functiong fSelect the next function.
goto-next-paragraph}Select the next paragraph.
goto-next-tagg xSelect the next tag pair (element).
goto-next-testg uSelect the next unit test.
goto-next-valueg vSelect the next array/tuple/struct value.
goto-prev-argumentg ASelect the previous argument.
goto-prev-classg TSelect the previous class or type.
goto-prev-commentg CSelect the previous comment.
goto-prev-functiong FSelect the previous function.
goto-prev-paragraph{Select the previous paragraph.
goto-prev-tagg XSelect the previous tag pair (element).
goto-prev-testg USelect the previous unit test.
goto-prev-valueg VSelect the previous array/tuple/struct value.
jump-backwardCtrl-oNavigate to the previous position in the jump list.
jump-forwardCtrl-i / Tab (without kitty)Navigate to the next position in the jump list.
move-downj / ↓Move cursors down one visual line; with a count, that many buffer lines.
move-lefth / ←Move cursors one character to the left.
move-rightl / →Move cursors one character to the right.
move-upk / ↑Move cursors up one visual line; with a count, that many buffer lines.
repeat-find-backward-Repeat the last find/till motion backward.
repeat-find-forward=Repeat the last find/till motion forward.
select-linex / Ctrl-xSelect the full current line (forward).
select-line-backwardX / Ctrl-Shift-x (kitty)Select the full current line (backward).
select-next-uppercase-wordWSelect the next uppercase word (whitespace-delimited).
select-next-wordwSelect the next word.
select-prev-uppercase-wordBSelect the previous uppercase word (whitespace-delimited).
select-prev-wordbSelect the previous word.
till-backwardT + charMove to the character after the previous occurrence of a character (exclusive). From call!, pass the character as an argument.
till-forwardt + charMove to the character before the next occurrence of a character (exclusive). From call!, pass the character as an argument.

Selection commands ​

Create, refine, or manipulate the selection set.

CommandDefault keyEffect
collapse-and-exit-extend;Collapse each selection to its cursor and exit Extend mode.
collapse-selection—Collapse each selection to a single cursor at the head.
collapse-to-anchor-and-exit-extendCtrl-; (kitty)Collapse each selection to its anchor and exit Extend mode.
copy-selection-on-next-lineCDuplicate each selection one selection-height below.
copy-selection-on-prev-line—Duplicate each selection one selection-height above.
cycle-primary-backward(Cycle the primary selection backward.
cycle-primary-forward)Cycle the primary selection forward.
flip-selectionsCtrl-eSwap anchor and head for each selection.
keep-primary-selection,Remove all selections except the primary.
remove-primary-selectionCtrl-, (kitty)Remove the primary selection, promoting the next.
select-all%Select the entire buffer.
select-last-insertionm i iSelect the text typed during the most recently completed insert session.
sift-withinsNarrow each selection down to its regex matches. From call!, the pattern is required.
split-selection-on-newlinesSSplit each multi-line selection into one per line.
trim-selection-whitespace_Trim leading and trailing whitespace from each selection.

Text objects ​

Select a delimited region around the cursor. An object that needs grammar support works only in a language whose grammar provides it; see Syntax Highlighting.

CommandDefault keyEffect
around-anglem a < / m a >Select content including the nearest <>.
around-argumentm a aSelect the argument and its separator comma. Uses the grammar when it supports arguments, a plain-text scan otherwise.
around-backtickm a `Select content including the nearest backtick pair.
around-bracem a { / m a }Select content including the nearest {}.
around-bracketm a [ / m a ]Select content including the nearest [].
around-classm a tSelect the class or type including its header. Needs grammar support.
around-commentm a cSelect the whole comment block. Needs grammar support.
around-double-quotem a "Select content including the nearest ".
around-functionm a fSelect the function including its signature (and attributes/decorators). Needs grammar support.
around-linem a lSelect the line including its newline.
around-paragraphm a pSelect the paragraph plus its trailing blank gap.
around-parenm a ( / m a )Select content including the nearest ().
around-single-quotem a 'Select content including the nearest '.
around-tagm a xSelect a pair of tags and their content. Uses the grammar when it supports tags, a plain-text scan otherwise.
around-testm a uSelect the whole unit test, including its attribute or decorator. Needs grammar support.
around-uppercase-wordm a WSelect uppercase word plus one adjacent whitespace run.
around-valuem a vSelect an array/tuple/struct value plus its separator comma. Needs grammar support.
around-wordm a wSelect word plus one adjacent whitespace run.
inner-anglem i < / m i >Select content inside the nearest <>.
inner-argumentm i aSelect the argument at the cursor (trimmed). Uses the grammar when it supports arguments, a plain-text scan otherwise.
inner-backtickm i `Select content inside the nearest backtick pair.
inner-bracem i { / m i }Select content inside the nearest {}.
inner-bracketm i [ / m i ]Select content inside the nearest [].
inner-classm i tSelect inside a class or type. Needs grammar support.
inner-commentm i cSelect inside a comment. Needs grammar support.
inner-double-quotem i "Select content inside the nearest ".
inner-functionm i fSelect inside a function. Needs grammar support.
inner-linem i lSelect inner line content (excluding the newline).
inner-paragraphm i pSelect the paragraph's text, excluding any trailing blank gap.
inner-parenm i ( / m i )Select content inside the nearest ().
inner-single-quotem i 'Select content inside the nearest '.
inner-tagm i xSelect the content between a pair of tags. Uses the grammar when it supports tags, a plain-text scan otherwise.
inner-testm i uSelect inside a unit test function's body. Needs grammar support.
inner-uppercase-wordm i WSelect inner uppercase word (whitespace-delimited).
inner-valuem i vSelect inside an array/tuple/struct value. Needs grammar support.
inner-wordm i wSelect inner word.
select-uppercase-wordM MSelect the uppercase word under the cursor.
select-wordm mSelect the word under the cursor.
select-word-nearest-on-line—Select the word under the cursor, or the nearest word on the same visual line when on whitespace. The whitespace it adds follows word-selects-whitespace.

Surround ​

Select or wrap delimiter pairs.

CommandDefault keyEffect
surround-addm w + charWrap each selection with a delimiter pair. Reads the next typed character to determine the pair. From call!, pass the character as an argument.
surround-anglem s < / m s >Select surrounding <> delimiters.
surround-backtickm s `Select surrounding ` delimiters.
surround-bracem s { / m s }Select surrounding {} delimiters.
surround-bracketm s [ / m s ]Select surrounding [] delimiters.
surround-double-quotem s "Select surrounding " delimiters.
surround-parenm s ( / m s )Select surrounding () delimiters.
surround-single-quotem s 'Select surrounding ' delimiters.

Edits ​

Modify buffer text.

CommandDefault keyEffect
align-selections&Align each selection's anchor to the primary selection's anchor column.
cancel-pipeCtrl-cStop the shell command pipe is running in the buffer and change nothing. Says so when none is running there.
changecDelete selections onto the kill ring, then enter Insert mode (one undo step).
decrementCtrl-sSubtract the count from the number, date or time at each selection.
decrement-sequenceG SSubtract n times the count from the number, date or time at the n-th selection.
deletedDelete selections, pushing their text onto the kill ring.
delete-char-backward—Delete the character before each cursor.
delete-char-forward—Delete the character (or selection) under the cursor.
delete-selection—Delete all selections.
delete-word-backwardCtrl-w (Insert mode)Delete the word before each cursor.
incrementCtrl-aAdd the count to the number, date or time at each selection.
increment-sequenceG AAdd n times the count to the number, date or time at the n-th selection.
indent>Indent every line touched by a selection by one level.
join-lines-select-spacesJJoin lines inside each selection and select the inserted spaces.
make-text-capitalizedG CCapitalize each word in every selection (Title Case).
make-text-lowercaseG LLowercase the text in each selection.
make-text-uppercaseG UUppercase the text in each selection.
open-line-aboveOOpen a new line above the cursor and enter Insert mode.
open-line-belowoOpen a new line below the cursor and enter Insert mode.
pipe| / Ctrl-| (Insert mode, kitty)Run a shell command once per selection, with the selection as its input, and replace the selection with its output. In Insert mode, insert its output at each cursor. Only from a key: calling it from Scheme raises an error.
replacer + charReplace every character in each selection with the next typed character. From call!, pass the character as an argument.
toggle-commentG GComment or uncomment the lines of each selection.
unindent<Unindent every line touched by a selection by one level.

Clipboard and registers ​

Move text between the buffer, the kill ring, and the system clipboard.

CommandDefault keyEffect
paste-after—Paste register contents after the selection. With no register prefix, reads the kill-ring head, with no clipboard fallback.
paste-before—Paste register contents before the selection. With no register prefix, reads the kill-ring head, with no clipboard fallback.
paste-ring-newer]Cycle kill ring one step newer and re-paste.
paste-ring-older[Cycle kill ring one step older and re-paste.
smart-paste-afterpSmart paste after the selection: the kill-ring head if you have edited nothing since you last deleted, changed or yanked text, the clipboard otherwise.
smart-paste-beforePSmart paste before the selection, choosing the source as p does.
yankyCopy selections to the clipboard and kill ring without deleting.
insert-registerCtrl-r (Insert mode, : prompt)Insert the register named by the next key, or the file's path (f) or its directory (p), relative to the working directory. See Inserting a register while typing.

Undo and repeat ​

Replay or roll back past changes.

CommandDefault keyEffect
redoU / Ctrl-rRedo the last undone change.
repeat-last-action.Repeat the last editing action. Only from a key: calling it from Scheme raises an error.
undouUndo the last change.

Find text and act on the matches.

CommandDefault keyEffect
clear-search—Clear search highlights. Esc also clears them.
search-backward?Enter Search mode (backward). From call!, the pattern is required.
search-forward/Enter Search mode (forward). From call!, the pattern is required.
search-nextnJump to the next search match.
search-prevNJump to the previous search match.
search-selectionCtrl-/ (kitty)Use the primary selection text literally as the search pattern.
search-word-under-cursor*Search the whole word under the cursor.
select-all-matchesm /Turn every search match in the buffer into a selection.

Modes ​

Switch between Normal, Insert and Extend mode, and open the : prompt.

CommandDefault keyEffect
command-mode:Open the : prompt.
completion-triggerCtrl-Space (Insert mode)Show completions at the cursor.
exit-insertEsc / Ctrl-cReturn to Normal mode from Insert mode.
insert-after—Enter Insert mode after the cursor (one character right).
insert-at-line-endAEnter Insert mode after the last character on the line.
insert-at-line-startIEnter Insert mode at the first non-blank character on the line.
insert-at-selection-endaEnter Insert mode after the end of the selection.
insert-at-selection-startiEnter Insert mode at the start of the selection.
insert-before—Enter Insert mode; collapse each selection to its start.
toggle-extendeToggle Extend mode.

Scrolling ​

Move the viewport without moving the cursor.

CommandDefault keyEffect
bottom-view-on-cursorz jScroll so the primary selection head sits at the bottom of the viewport.
center-view-on-cursorz zScroll so the primary selection head sits at the vertical center of the viewport.
half-page-downCtrl-dScroll down by half a viewport height.
half-page-upCtrl-uScroll up by half a viewport height.
page-downPageDownScroll down by one viewport height.
page-upPageUpScroll up by one viewport height.
top-view-on-cursorz kScroll so the primary selection head sits at the top of the viewport.

Panes, buffers, and tabs ​

Split, focus, and close panes; switch buffers; switch tabs.

CommandDefault keyEffect
goto-alternate-buffer—Switch to the most-recently-focused other buffer.
goto-next-buffer—Switch to the next buffer, in the order they were opened.
goto-next-tabCtrl-p tSwitch to the next tab in display order.
goto-prev-buffer—Switch to the previous buffer, in the order they were opened.
goto-prev-tabCtrl-p TSwitch to the previous tab in display order.
pane-closeCtrl-p cClose the focused pane.
pane-focus-downCtrl-p jFocus the pane below.
pane-focus-leftCtrl-p hFocus the pane to the left.
pane-focus-nextTab (kitty) / Ctrl-p pFocus the next pane.
pane-focus-prevShift-Tab (kitty) / Ctrl-p PFocus the previous pane.
pane-focus-rightCtrl-p lFocus the pane to the right.
pane-focus-upCtrl-p kFocus the pane above.
pane-rotate-backwardCtrl-p RRotate the panes in the focused pane's row or column backward (that many places with a count).
pane-rotate-forwardCtrl-p rRotate the panes in the focused pane's row or column forward (that many places with a count).
pane-splitCtrl-p sSplit the focused pane, stacking the new pane below it.
pane-vsplitCtrl-p vSplit the focused pane side by side.
tab-new—Open a fresh pane viewing the focused buffer in a new tab.

Released under the MIT License.