Key Bindings#

How Keys Work#

Every key press is dispatched through the keymap for the current mode. Normal, Select, and Insert are the editing modes; terminal panes, image panes, binary panes, prompts, and pickers each have their own bindings. The same physical key can do different things in different contexts, which is why this page is grouped by mode and context rather than by key.

Key sequences and prefixes. Many commands are bound to a sequence of keys, not a single press, g then d, or Ctrl+w then v. The first key of a sequence is a prefix; pressing it opens a popup listing the keys that can follow. The main prefixes are g (goto), m (match and surround), z and Z (view, the two are interchangeable), [ and ] (previous/next), Ctrl+w (windows), and the leader.

Leader. Space opens the leader menu. Ctrl+\ is equivalent and also works in terminal and image panes, where Space is passed through instead. See Leader Menu.

Counts. In Normal and Select mode, typing digits before a command repeats it that many times: 5j moves down five lines, 10G goes to line 10. A leading 0 is a command (line start), not a count. The pending count appears in the key popup and clears once the command runs. A count is only accepted before a command that takes one, and Backspace removes the last digit or key typed toward a command.

Placeholders. Some commands capture the next key(s) directly. In the tables these appear as:

  • <char>: a literal character to act on, e.g. f<char>, r<char>, ms<char>.
  • <reg>: a register letter, e.g. "<reg> before a yank or paste, Ctrl+r <reg> in insert mode.
  • <n>: a count typed before the key.

Registers. "<reg> chooses the register the next yank or paste uses; without it they use the default register. The popup lists the registers currently holding a value, with a preview of each. Yanks and pastes that go through the system clipboard live under the leader (Space+y, Space+p).

Insert mode. Any printable key with no binding is inserted as text; the Insert Mode bindings below are the exceptions that edit or move instead.

The rest of this page covers the three editing modes (Normal, Select, Insert) first, then the global facilities that apply across them: window management, the leader menu, terminal, image, and binary panes, prompts, and picker navigation.

Keys can be rebound and new actions scripted in Ale, see Scripting.

Download the printable Toe cheatsheet (PDF).

Normal Mode#

Normal mode is the default. Keys are commands, not text: you move the cursor, manipulate selections, and launch edits from here.

Motion#

KeyAction
h / Move left
j / Move down
k / Move up
l / Move right
wMove to start of next word
bMove to start of previous word
eMove to end of next word
WMove to start of next long word
BMove to start of previous long word
EMove to end of next long word
f<char>Move to next occurrence of char
t<char>Move till next occurrence of char
F<char>Move to previous occurrence of char
T<char>Move till previous occurrence of char
HomeGoto line start
EndGoto line end

Goto (g)#

The g prefix jumps somewhere; a count changes what gg does.

KeyAction
gg / <n>ggGoto line number <n> else file start
G / <n>GGoto line number <n>
gsGoto first non-blank in line
geGoto last line
g| / <n>g|Goto column
gtGoto window top
gcGoto window center
gbGoto window bottom
gdGoto definition
gDGoto declaration
gyGoto type definition
giGoto implementation
grGoto references
gfGoto files/URLs in selections
gnGoto next buffer
gpGoto previous buffer
gaGoto last accessed file
gmGoto last modified file
g.Goto last modification

Previous / Next ([ / ])#

The [ and ] prefixes step backward and forward through the same kind of target.

KeyAction
[pGoto previous paragraph
]pGoto next paragraph
[gGoto previous change
]gGoto next change
[GGoto first change
]GGoto last change
[␣Add newline above
]␣Add newline below

Jumplist#

KeyAction
Ctrl+oJump backward on jumplist
Ctrl+i / TabJump forward on jumplist
Ctrl+sSave current selection to jumplist

Switching Modes#

KeyAction
:Enter command mode
iInsert before selection
IInsert at start of line
aAppend after selection
AInsert at end of line
oOpen new line below selection
OOpen new line above selection
vEnter selection extend mode

Editing#

KeyAction
dDelete selection
Alt+dDelete selection without yanking
cChange selection
Alt+cChange selection without yanking
r<char>Replace with new char
~Switch (toggle) case
`Switch to lowercase
Alt+`` ``Switch to uppercase
>Indent selection
<Unindent selection
JJoin lines inside selection
Alt+JJoin lines inside selection and select spaces
&Align selections in column
_Trim whitespace from selections
Ctrl+aIncrement item under cursor
Ctrl+xDecrement item under cursor
=Format selection
uUndo change
URedo change
Alt+uMove backward in history
Alt+UMove forward in history

Yank and Paste#

KeyAction
yYank selection
pPaste after selection
PPaste before selection
RReplace with yanked text
"<reg>Select register for the next yank or paste

Clipboard yanks and pastes are under the Leader Menu (Space+y, Space+p, …).

KeyAction
/Search for regex pattern
?Reverse search for regex pattern
nSelect next search match
NSelect previous search match
*Use current selection as search pattern, word bounded
Alt+*Use current selection as search pattern

Selection#

KeyAction
sSelect all regex matches inside selections
SSplit selections on regex matches
KKeep selections matching regex
Alt+KRemove selections matching regex
Alt+sSplit selection on newlines
;Collapse selection into single cursor
Alt+;Flip selection cursor and anchor
%Select whole document
xSelect current line, if already selected, extend to next line
XExtend selection to line bounds
Alt+xShrink selection to line bounds
Alt+oExpand selection to syntax node
Alt+iShrink selection to syntax node
,Keep primary selection
Alt+,Remove primary selection
(Rotate selections backward
)Rotate selections forward
Alt+(Rotate selections contents backward
Alt+)Rotate selection contents forward
Alt+:Ensure all selections face forward
CCopy selection on next line
Alt+CCopy selection on previous line
Alt+-Merge selections
Alt+_Merge consecutive selections
Alt+.Repeat last motion

Match and Surround (m)#

KeyAction
mmGoto matching bracket
ms<char>Surround add
mr<from><to>Surround replace
md<char>Surround delete
ma<char>Select around object
mi<char>Select inside object

View and Scroll (z / Z)#

z and Z are the same prefix; either works.

KeyAction
zz / zcAlign view center
zt / z.Align view top
zbAlign view bottom
zk / z↑Scroll view up
zj / z↓Scroll view down
Ctrl+b / PageUpMove page up
Ctrl+f / PageDownMove page down
Ctrl+uMove page and cursor half up
Ctrl+dMove page and cursor half down

Comments and Macros#

KeyAction
Ctrl+cComment/uncomment selections
QRecord macro
qReplay macro

Comment variants (line, block) are on the Leader Menu under Space+c.

Shell#

KeyAction
|Pipe selections through shell command
Alt+|Pipe selections into shell command ignoring output
!Insert shell command output before selections
Alt+!Append shell command output after selections
$Filter selections with shell predicate

Select Mode#

Select mode extends the current selection: motion keys move the selection’s head instead of collapsing it. Enter it with v, leave it with Escape. Every Normal-mode command (editing, yank, search, and the rest) works the same here.

KeyAction
h/j/k/lExtend selection
w/b/e/W/B/EExtend by word
f/t/F/T<char>Extend to character
Home / EndExtend to line start/end
xSelect current line, if already selected, extend to next line
gg / <n>ggExtend to line number <n> else file start
geExtend to last line
g|Extend to column
n / NAdd next/previous search match to selection
EscapeExit selection mode

Insert Mode#

Printable keys type text. The bindings below edit or move instead; anything unbound is inserted.

KeyAction
EscapeEnter normal mode
/ Move by character
/ Move by line
HomeGoto line start
EndGoto newline at line end
Ctrl+r <reg>Insert register
Ctrl+sCommit changes to new checkpoint
Ctrl+h / BackspaceDelete previous char
Ctrl+d / DeleteDelete next char
Ctrl+w / Alt+BackspaceDelete previous word
Alt+d / Alt+DeleteDelete next word
Ctrl+uDelete till start of line
Ctrl+kDelete till end of line
Ctrl+j / ReturnInsert newline char
TabInsert tab in leading whitespace, otherwise move past the enclosing syntax node
Shift+TabInsert tab
Ctrl+xComplete current word
PageUp / Ctrl+bMove page up
PageDown / Ctrl+fMove page down

Completion Popup#

While the completion popup is open:

KeyAction
Return / TabAccept completion
EscapeCancel completion
/ Ctrl+pPrevious completion
/ Ctrl+nNext completion
PageUpPrevious completion page
PageDownNext completion page
HomeFirst completion
EndLast completion

Windows and Splits#

Window management works from any editing mode. The Ctrl+w chord and the leader’s w menu (Space+w or Ctrl+\ w) bind the same commands.

KeyAction
Ctrl+w nCreate a new scratch buffer
Ctrl+w xOpen a new terminal
Ctrl+w /Search the focused terminal’s scrollback
Ctrl+w v / Ctrl+w Ctrl+vVertical right split
Ctrl+w s / Ctrl+w Ctrl+sHorizontal bottom split
Ctrl+w t / Ctrl+w Ctrl+tTranspose splits
Ctrl+w q / Ctrl+w Ctrl+qClose window
Ctrl+w o / Ctrl+w Ctrl+oClose windows except current
Ctrl+w w / Ctrl+w Ctrl+wGoto next window
Ctrl+w zToggle focused pane maximized
Ctrl+w h/j/k/l / Ctrl+w ←/↓/↑/→Jump to left/below/above/right split
Ctrl+w H/J/K/LSwap with left/below/above/right split
Ctrl+w rEnter resize mode

Splitting a document or image pane opens another view of the same document or image; splitting a terminal starts a new shell. Splits can also be resized by dragging a separator with the mouse.

Ctrl+w z temporarily gives the focused pane the full editor area while preserving the split layout. The status line shows MAX while active. Press the key again to restore the layout.

Resize Mode#

Ctrl+w r enters resize mode.

KeyAction
h / Push the left border left
l / Push the right border right
j / Push the bottom border down
k / Push the top border up
Escape / EnterExit resize mode

Leader Menu#

Space (or Ctrl+\) opens the leader menu, a shared set of commands reachable from every mode. Pressing the leader shows a popup of the entries below.

KeyAction
Space+yYank selections to clipboard
Space+YYank main selection to clipboard
Space+pPaste clipboard after selections
Space+PPaste clipboard before selections
Space+RReplace selections by clipboard content
Space+wWindow menu (see Windows and Splits)
Space+hSelect symbol references
Space+aPerform code action
Space+kShow docs for item under cursor
Space+rRename symbol
Space+sOpen symbol picker
Space+SOpen workspace symbol picker
Space+fOpen file picker
Space+FOpen file picker at current working directory
Space+gOpen changed-file picker
Space+eOpen file explorer at workspace root
Space+.Open file explorer at current pane’s directory
Space+bOpen buffer picker
Space+jOpen jumplist picker
Space+dOpen diagnostic picker
Space+DOpen workspace diagnostic picker
Space+/Global search in workspace folder
Space+?Open command palette
Space+'Reopen the last picker
Space+cComment/uncomment selections
Space+Alt+cLine comment/uncomment selections
Space+CBlock comment/uncomment selections

Terminal Panes#

While a terminal pane has focus, keys pass straight to the shell. The exceptions are Ctrl+w, which opens the window menu, and Ctrl+\, which opens the leader menu (Space is not intercepted here).

KeyAction
Ctrl+wOpen the window menu
Ctrl+w /Search the focused terminal’s scrollback
Ctrl+w qClose the pane and kill its shell
Ctrl+\Open the terminal’s leader menu
Ctrl+\ pPaste the clipboard into the terminal
Ctrl+\ f / Ctrl+\ bOpen the file / buffer picker
Mouse wheelScroll into scrollback; any keypress returns to live output
Mouse click/dragSelect and copy terminal text when mouse tracking is off
Mouse click/drag/wheelForwarded to the shell when it enables mouse tracking (e.g. vim, htop)

Image Panes#

Image panes support the command prompt, window menu, and leader.

KeyAction
:Enter command mode
+ / =Zoom image in
-Zoom image out
0Fit image to pane and recenter
h j k l / arrowsPan a zoomed-in image
g a / g mGoto last accessed / modified file
Mouse clickZoom image in
Right click / Mod + clickZoom image out
Mouse wheel / two-finger swipePan a zoomed-in image
Mod + wheelZoom image in or out
Ctrl+w / Space+wWindow menu

Binary Panes#

Files that are neither text nor a supported image open as a read-only hexadecimal dump. Binary panes support the command prompt, window menu, and leader.

KeyAction
:Enter command mode
j / k / arrowsScroll one row
PgDn / PgUpScroll one page
HomeJump to start
G / EndJump to end
g a / g mGoto last accessed / modified file
Mouse wheelScroll
Ctrl+w / Space+wWindow menu

Prompts#

Commands (:), search (/, ?), and other text prompts open a popup in the centre of the frame. Command completions list beside the input as you type, matched on the command name and annotated with what it does; Tab cycles them. There is no command line: messages appear as notifications in the bottom-right corner, and the selected register and macro-recording indicator sit on the corner statusline.

KeyAction
/ / Ctrl+b / Ctrl+fMove by character
Ctrl+← / Ctrl+→ / Alt+b / Alt+fMove by word
Home / Ctrl+aMove to start
End / Ctrl+eMove to end
Backspace / Ctrl+hDelete char before caret
Delete / Ctrl+dDelete char after caret
Ctrl+w / Alt+BackspaceDelete word before caret
Alt+d / Ctrl+DeleteDelete word after caret
Ctrl+uDelete to start
Ctrl+kDelete to end
Tab / Shift+TabNext/previous completion
ReturnSubmit
EscapeCancel

Picker Navigation#

When any picker is open (file picker, buffer picker, global search, etc.):

KeyAction
/ Ctrl+p / Shift+TabMove up
/ Ctrl+n / TabMove down
PageUp / Ctrl+uMove page up
PageDown / Ctrl+dMove page down
HomeJump to first item
EndJump to last item
ReturnOpen selected item
Ctrl+sOpen in horizontal split
Ctrl+vOpen in vertical split
EscapeClose picker