Skip to main content

Emacs Editor

An Emacs-style cheatsheet for Rune's built-in Emacs editor. It combines familiar point, mark, and kill-ring editing, incremental search, and numeric arguments with Rune commands for files, windows, tabs, search, and language intelligence.

Choose emacs when Rune first asks which key bindings you want. For an existing configuration, the editor itself is selected with:

editor:
mode: "emacs"

The setup preset also installs <alt-x>, the <ctrl-x> command family, and the command-layer unbindings that leave Emacs editing keys available to the editor. Changing only editor.mode does not replace command bindings already in your config. If you maintain those bindings yourself, merge changes into the existing command map rather than adding a second top-level command key.

See the key syntax reference for the notation used on this page.

Alt is Emacs Meta

Rune keeps the Emacs editing layer and Rune's window-management layer on different modifiers:

  • <alt> is the Emacs Meta modifier. It is Option on macOS and Alt on Linux.
  • <meta> is Rune's window and workspace modifier. It is Command on macOS and Super on Linux.

For example, Emacs forward-word is <alt-f>, while Rune window focus uses <meta-h> and <meta-l>. An Emacs control-plus-Meta command such as forward-sexp is <ctrl-alt-f>.

Where Emacs editing applies

The same built-in editor powers file buffers and Rune-owned text surfaces, including prompts and command output. The Emacs preset leaves terminals modeless, so a program running in a terminal receives its own input and owns its own editing behavior.

Point motion

Characters and lines

KeyMotion
<left> <ctrl-b>one character left
<right> <ctrl-f>one character right
<up> <ctrl-p>one line up
<down> <ctrl-n>one line down
<home> <ctrl-a>start of line
<end> <ctrl-e>end of line
<alt-m>first nonblank character on the line

Left and right motion stop at line boundaries. Use line motion to cross to the preceding or following line.

Words, buffers, and expressions

KeyMotion
<alt-b> <alt-left>previous word start
<alt-f> <alt-right>current or next word end
<alt-shift-,>beginning of the buffer
<alt-shift-.>end of the buffer
<ctrl-m>matching bracket
<ctrl-alt-f>forward across the next bracketed expression
<ctrl-alt-b>backward across the preceding bracketed expression
<ctrl-alt-u>up and out to the opening bracket of the enclosing pair
<ctrl-alt-d>down into the next opening bracket
<ctrl-alt-a>start of the enclosing definition
<ctrl-alt-e>end of the enclosing definition
<ctrl-alt-k>kill the next bracketed expression

Rune's expression motions recognize balanced (), [], and {}. They scan for the next opening or preceding closing bracket and do not treat a bare word, string, or reader form as a complete expression.

<alt-shift-,> and <alt-shift-.> are the physical chords behind GNU Emacs's beginning-of-buffer and end-of-buffer commands. Definition motion uses the buffer's fold structure, so it depends on language support.

Sentences and paragraphs

KeyMotion
<alt-a>backward to the sentence start
<alt-e>forward to the sentence end
<alt-shift-[>backward to the previous paragraph
<alt-shift-]>forward to the next paragraph

Sentence motion follows the GNU Emacs defaults: a sentence ends at ., ?, or !, optionally followed by closing quotes or brackets, and then the end of a line, a tab, or two spaces. A single space does not end a sentence, so abbreviations such as Mr. Smith do not break the motion. Sentences never cross a blank line except when the current paragraph has none left.

Pages and scrolling

KeyAction
<pgup>move point one viewport up
<pgdn>move point one viewport down
<ctrl-v>page down
<alt-v>page up
<ctrl-l>center the current line
<ctrl-alt-up>scroll the view up one line
<ctrl-alt-down>scroll the view down one line

With a numeric argument, <ctrl-v> and <alt-v> scroll that many lines instead of a page.

Selection, mark, and region

Shift with a basic motion creates or extends an ordinary selection:

KeyAction
<shift-left> <shift-right>extend selection by one character
<shift-up> <shift-down>extend selection by one line
<shift-home> <shift-end>extend to the start or end of the line
<shift-pgup> <shift-pgdn>extend by one viewport
<esc>clear selection and search highlighting

Mark and region commands use the most recently set mark:

KeyAction
<ctrl-space>set mark at point
<alt-w>copy from mark to point
<ctrl-w>kill from mark to point
<ctrl-u><ctrl-space>jump to the most recent mark and pop it
<ctrl-x><ctrl-x>exchange point and the most recent mark
<ctrl-g>quit: cancel a pending prompt or argument; clear selection, search, and marks

<alt-w> leaves point and the buffer unchanged. <ctrl-w> kills the region into the clipboard and consumes its mark. Each <ctrl-space> pushes a mark, and repeating <ctrl-u><ctrl-space> walks back through older marks, like the GNU Emacs mark ring.

Syntactic selection

KeyAction
<ctrl-=>expand selection to the next syntactic boundary
<ctrl-shift-w>shrink syntactic selection
<ctrl-shift-m>select enclosing (), {}, or []

Syntactic selection depends on language support for the current buffer.

Editing

Typing, indentation, and undo

KeyAction
any printable keyinsert text; replace the active selection
<space>insert a space
<enter>insert an indented newline; honor an empty auto-pair
<tab>indent selection or line; otherwise insert one indentation unit
<shift-tab>outdent selection or line
<backspace> <ctrl-h>delete backward
<delete> <ctrl-d>delete at point
<ctrl-/> <ctrl-_> <ctrl-z>undo
<ctrl-alt-/>redo

The Emacs preset enables auto-pairing. Typing (, [, {, ", or ' inserts its matching close. <backspace> between an empty pair removes both characters, and <enter> between paired brackets opens an indented line.

Undo follows the GNU one-undo-per-command rule: a command that performs several internal edits, such as <alt-shift-6>, <alt-t>, or a whole query-replace session, reverts in a single step. Consecutive typed characters group into one undo of up to twenty characters, and runs of <backspace> or <ctrl-d> group the same way. In a terminal, <ctrl-/>, <ctrl-_>, and <ctrl-7> all send the same control code, so any of them undoes; <ctrl-z> is kept as a familiar alias. Redo is GNU Emacs 28's undo-redo, also available as <ctrl-shift-/> in the GUI.

Transposing

KeyAction
<ctrl-t>transpose the characters around point; at the end of a line, swap the last two
<alt-t>transpose the words around point and move past them

Both follow their GNU semantics: repeating <ctrl-t> drags a character forward, and <alt-t> before the first word of the buffer does nothing.

Newlines and line operations

KeyAction
<ctrl-o>open a line and leave point before the new newline
<ctrl-j>insert a newline and indent
<ctrl-enter>insert a blank line below
<ctrl-shift-enter>insert a blank line above
<alt-shift-6>join the current line onto the previous one
<alt-up> <alt-down>move the line or selection up or down
<alt-shift-up> <alt-shift-down>duplicate the line or selection up or down

<alt-shift-6> is the physical chord behind the Emacs delete-indentation command. Like GNU Emacs, it joins the current line onto the previous one and fixes the whitespace at the join down to a single space.

Killing and whitespace

KeyAction
<ctrl-k>kill to the end of the line; at the end of a line, kill the newline
<ctrl-shift-k>kill the entire line, newline included
<alt-d> <alt-delete>kill forward through the current or next word
<alt-backspace>kill backward to the previous word start
<alt-k>kill forward to the sentence end
<alt-z>zap: read a character, then kill through its next occurrence
<alt-space>collapse whitespace around point to one space
<alt-\\>delete spaces and tabs around point

Kill commands save the removed text to Rune's clipboard, and consecutive kills accumulate into a single entry: forward kills append, backward kills prepend, and any other command ends the chain. Two <ctrl-k> in a row kill a line and its newline as one yankable unit, and <alt-d><alt-d> collects two words.

<alt-z> prompts for a character in the echo area and kills from point through its next occurrence, across lines if needed. When the character is not found, nothing is killed. <ctrl-g> cancels the prompt.

<alt-\\> leaves point where the horizontal whitespace began. It does not cross a line boundary.

Copy, yank, and clipboard history

KeyAction
<ctrl-c>copy the active selection
<alt-w>copy the mark-to-point region
<ctrl-y>yank from Rune's clipboard
<alt-y>replace the last yank with an older clipboard-history entry

Rune's shared clipboard history plays the role of the GNU Emacs kill ring: kill commands such as <ctrl-k>, <ctrl-w>, <alt-d>, <alt-k>, and <alt-z> all save their text there, alongside <ctrl-c> and <alt-w> copies. <alt-y> only runs directly after a yank, and it walks the history from newest to oldest, wrapping around at the end. With a numeric argument, <ctrl-u>N<ctrl-y> yanks the Nth most recent entry and <ctrl-u><ctrl-y> yanks while leaving point in front of the inserted text.

<ctrl-c> is copy in Rune's Emacs editor, so it is not available as a command prefix. Rune places IDE commands under <ctrl-x> instead.

Words, paragraphs, and comments

KeyAction
<alt-u>uppercase the current or next word
<alt-l>lowercase the current or next word
<alt-c>capitalize the current or next word
<alt-q>fill the paragraph at Rune's ruler column
<alt-;>toggle the language's line comment

Word boundaries follow Rune's cursor rules. Line comments require comment syntax for the current language.

Search and replace

KeyAction
<ctrl-s>start an incremental search forward
<ctrl-r>start an incremental search backward
printable keysextend the query; point follows the nearest match live
<ctrl-s> <ctrl-r> while searchingnext or previous match; with an empty query, resume the last search
<backspace>remove the last query character
<enter> <esc>accept the search, leaving point at the match
<ctrl-g>abort the search and return to where it began

Like GNU Emacs, a forward search leaves point at the end of the match and a backward search at its start, and repeating past the last match wraps around the buffer. Any other editing or motion key accepts the search and then runs normally. The match highlight survives accepting; press <esc> or <ctrl-g> to clear it. <ctrl-s><ctrl-s> from an empty prompt repeats the most recently accepted search.

Query replace

<alt-shift-5> starts query-replace: it prompts for the search text, then the replacement, then stops on each match:

KeyAction
y <space>replace this match and continue
n <backspace>skip this match
!replace this and every remaining match
.replace this match and stop
q <enter> <esc>stop
<ctrl-g>quit

The whole session, including a ! replace-all, reverts with a single undo.

Go to line

<alt-g>g (also <alt-g><alt-g>) prompts for a line number and moves point there, clamped to the buffer.

The shipped preset puts workspace search under <ctrl-x>:

KeyAction
<ctrl-x>gsearch text across the workspace
<ctrl-x>nnext workspace-search result
<ctrl-x>pprevious workspace-search result

See the Search tools for everything beyond the current buffer.

Numeric arguments

Most motion and editing commands accept a repeat count entered before the command, exactly as in GNU Emacs:

KeyAction
<ctrl-u>four; repeat to multiply, so <ctrl-u><ctrl-u> is sixteen
<ctrl-u> digitsan explicit count, such as <ctrl-u>12<alt-f>
<alt-0> through <alt-9>digit argument, such as <alt-5><ctrl-f>
<alt-->negative argument
<ctrl-g>cancel the pending argument

<ctrl-u>8x inserts eight x characters, <ctrl-u><ctrl-n> moves four lines down, and <alt-2><alt-0><ctrl-f> moves twenty characters forward. Counted kills accumulate into a single clipboard entry, and a counted command reverts with a single undo. Pressing <ctrl-u> after typing digits ends the count, so <ctrl-u>5<ctrl-u>7 inserts 77777.

A negative argument runs the command in the opposite direction: <alt--><alt-f> moves back a word, <alt-->3<ctrl-d> deletes three characters backward, and <alt--><alt-e> moves back a sentence. <ctrl--> also enters a negative argument in the GUI; a terminal folds it onto the same key as <ctrl-/>, so use <alt--> in a terminal.

Some commands give the argument its GNU-specific meaning instead of a plain repeat:

KeyAction
<ctrl-u><ctrl-space>jump to the most recent mark and pop it
<ctrl-u>N<ctrl-k>kill N whole lines; zero kills to the line start; negative kills backward
<ctrl-u><ctrl-y>yank, leaving point before the inserted text
<ctrl-u>N<ctrl-y>yank the Nth most recent clipboard entry
<ctrl-u>N<alt-y>rotate the last yank N entries back
<ctrl-u>N<ctrl-v> <ctrl-u>N<alt-v>scroll N lines instead of a page
<ctrl-u>N<alt-z>zap through the Nth occurrence; negative zaps backward
<alt--><alt-k>kill backward to the sentence start
<alt--><alt-u> <alt--><alt-l> <alt--><alt-c>change the case of the previous words without moving point

Folds and hidden text

KeyAction
<ctrl-shift-z>toggle the fold at point
<ctrl-shift-a>toggle all folds
<ctrl-alt-h>hide the active selection
<ctrl-alt-v>reveal hidden text

Fold commands depend on syntactic fold information for the current buffer.

Keyboard macros

KeyAction
<ctrl-q>start or stop recording into the unnamed register
<ctrl-shift-q>play the unnamed register once

These are Rune's compact macro chords rather than GNU Emacs's multi-key macro sequences. See the Clipboard guide for how shared registers fit into editing workflows.

Command Prompt

<alt-x> opens Rune's Command Prompt. Start typing a command name to fuzzy-filter all available commands, then press <enter> to run it. This is the Rune counterpart to execute-extended-command, with IDE, workspace, language, agent, and terminal commands in the same prompt.

The <ctrl-x> command family

These sequences are installed by Rune's full Emacs setup preset. They are Rune command bindings, not an open-ended Emacs prefix map.

Files and session

KeyAction
<ctrl-x><ctrl-s>save the current buffer
<ctrl-x>ssave all modified buffers
<ctrl-x><ctrl-f>search for a workspace file
<ctrl-x><ctrl-c>quit Rune

Quitting does not implicitly run save-all. Save first when you want to keep all modified buffers.

Cursor history and mark

KeyAction
<ctrl-x>[previous cursor-history location
<ctrl-x>]next cursor-history location
<ctrl-x><ctrl-x>exchange point and mark

Language intelligence and changes

KeyAction
<ctrl-x>dgo to definition
<ctrl-x>rfind references
<ctrl-x>igo to implementation
<ctrl-x>tshow hover and type information
<ctrl-x>bformat the current buffer
<ctrl-x>eshow diagnostics
<ctrl-x>jnext diagnostic
<ctrl-x>lprevious diagnostic
<ctrl-x><ctrl-n>next Git change
<ctrl-x><ctrl-p>previous Git change
<ctrl-x>/request language completion

Language commands depend on the language support available in the current workspace.

Bookmarks

KeyAction
<meta-f2>toggle a bookmark at point
<f2>next bookmark
<shift-f2>previous bookmark
<alt-f2>highlight bookmarks
<shift-meta-f2>delete all bookmarks

Rune's Meta layout layer

The Emacs preset keeps Rune's global <meta> layout controls active, and window and tab management live here rather than under <ctrl-x>. Terminals and window managers frequently intercept <ctrl-x> before it reaches Rune, so homing these commands on <meta> (Command on macOS, Super on Linux) keeps them reliable. Real Emacs never uses this modifier, so there is no editor conflict. The most important defaults are:

KeyAction
<meta-h> <meta-j> <meta-k> <meta-l>focus a neighboring window
<shift-meta-h> <shift-meta-j> <shift-meta-k> <shift-meta-l>move the current window
<ctrl-meta-h>split right
<ctrl-meta-v>split below
<meta-w>close the current window
<shift-meta-f>toggle maximization of the current window
<meta-]> <meta-[>next or previous tab
<shift-meta-w>close the current tab
<shift-meta-]> <shift-meta-[>move the current tab right or left
<meta-enter>open a terminal
<meta-1> through <meta-9>focus workspace 1 through 9
<shift-meta-1> through <shift-meta-9>move the current item to a workspace

See Layout Management for the complete window and workspace system.

Differences from GNU Emacs

Rune's Emacs editor targets familiar editing muscle memory without embedding the complete GNU Emacs command system. The main differences are:

  • <alt> is Emacs Meta, while <meta> is reserved for Rune layouts.
  • <ctrl-c> copies a selection. There is no <ctrl-c> prefix map.
  • <ctrl-x> contains the specific Rune command sequences listed above, not a general Emacs prefix keymap.
  • The kill ring is Rune's shared clipboard history, so kills and copies are visible to the rest of Rune and to other buffers.
  • Expression motion is bracket-based and does not move across bare atoms.
  • Registers, rectangle commands, and recursive editing are not implemented.
  • Keyboard macros use Rune's compact <ctrl-q> chords rather than the GNU <ctrl-x>( sequences.

If you need a complete Emacs environment rather than Rune's built-in keymap, run Emacs inside Rune with Exoeditor.

Ask Rune Agent