TUI keymap

The gnaw TUI is modal and vim-flavoured. This page lists every binding, grouped by the mode or tab it applies in. Launch the interface with:

gnaw --tui            # current directory
gnaw ./my-repo --tui  # a specific path

Modes

gnaw has three top-level interaction modes. Only the command line is stored; the rest is derived from context, so you rarely think about modes explicitly — but they explain which keys are live at any moment.

ModeYou're in it when…What keys do
NormalBrowsing a tab, nothing being typedNavigation and single-key actions
InsertA text field is focused — file-tree search, a template variable value, or the template editorCharacters go into the field; Esc leaves it
CommandThe : command line is openCharacters build a command; Enter runs it, Esc cancels

Global (Normal mode, any tab)

KeyAction
15Jump straight to a tab (see below)
TabNext tab
Shift+TabPrevious tab
:Open the command line
Ctrl+QQuit immediately
EscNothing (does not quit)

The five tabs, in order: 1 File tree · 2 Settings · 3 Statistics · 4 Template · 5 Prompt output.

Command line

Open with :. While it's open:

KeyAction
(type)Build the command
EnterExecute
BackspaceDelete a character
EscCancel and close

Commands

CommandEffect
:q · :q! · :quitQuit
:sortToggle tree ordering (path ↔ token weight)
:sort tokens · :sort weightOrder the tree by token weight, heaviest first
:sort path · :sort nameOrder the tree by path (directories first, then alphabetical)
:collapseCollapse every folder
:size >NShow only files larger than N tokens
:size <NShow only files smaller than N tokens
:size 0 · :sizeClear the size filter

N accepts k and m suffixes — :size >500, :size <2k, :size <1m. Size filtering compares against each file's counted token total, so files that haven't been counted yet are hidden while a filter is active.

File tree — 1

The default tab. Browse the repository, select what goes into the prompt.

Browsing

KeyAction
/ k · / jMove the cursor
PageUp / PageDownMove by 10
Home / g · End / GJump to top / bottom
SpaceToggle selection of the file or directory at the cursor
/ lExpand a directory
/ hCollapse a directory
/ or sEnter search
aSelect every currently matched file
dDeselect every currently matched file
rRefresh the tree from disk
EnterGenerate the prompt from the current selection
KeyAction
(type)Edit the query — the tree filters live
BackspaceDelete a character
Ctrl+PRecall the previous search from history
EnterApply the filter and leave search
EscLeave search

Settings — 2

KeyAction
· Move the cursor
SpaceToggle the highlighted setting
· Cycle the highlighted setting's value
EnterGenerate the prompt

Statistics — 3

Three views, cycled in place.

KeyAction
· Cycle view: Overview → Token map → Extensions
· Scroll
PageUp · PageDownScroll by 5
Home · EndTop / bottom
EnterGenerate the prompt

Template — 4

A three-pane tab: a picker (choose a built-in or saved template), an editor, and a variable list. From Normal focus:

KeyAction
eFocus the editor and start editing
vFocus the variable list and start editing
pFocus the template picker
sSave the current template to a timestamped file
rReload the default template
EnterGenerate the prompt

Picker focus

KeyAction
· Move the selection
Enter / l / SpaceLoad the highlighted template
rRefresh the template list

Variable focus

KeyAction
· Move between variables
Enter / SpaceStart editing the highlighted (missing) variable
(type) / BackspaceEdit the value
EnterCommit the value
EscCancel the edit / leave editing

Editor focus

Plain text entry into the template body. Esc leaves the editor.

Prompt output — 5

The rendered prompt.

KeyAction
· Scroll
PageUp · PageDownScroll by 10
Home · EndTop / bottom
cCopy the output to the clipboard
sSave the output to a timestamped .md file
EnterRe-generate