PiG Documentation

Guides and references for configuring, using, and extending PiG.

Keybindings

PiG reads keybindings from ~/.pig/agent/keybindings.json. The file is optional. If it is absent, PiG uses the defaults in this page.

Each entry maps one action to one or more keys. To change a binding, write the action name and the keys you want:

{
  "app.tools.expand": ["ctrl+e"],
  "app.session.tree": ["ctrl+shift+t"]
}

A binding in the file replaces the default for that action. It does not add to it. Bindings you do not name keep their defaults. Set an action to [] to leave the action with no key.

Set PIG_CODING_AGENT_DIR to read the file from a different directory.

Use /hotkeys to list the keys that are active in the current session.

If two actions claim the same key, PiG records the conflict and keeps both bindings. Both actions then answer that key, so give one of them a different key.

Defaults

The keys below are the macOS defaults. Platform differences are listed after the tables.

Session control

Action
Default key
Effect
app.clearctrl+cClear editor
app.exitctrl+dExit when editor is empty
app.interruptescapeCancel or abort
app.session.deletectrl+dDelete session
app.session.deleteNoninvasivectrl+backspaceDelete session when query is empty
app.session.forknoneFork current session
app.session.newnoneStart a new session
app.session.renamectrl+rRename session
app.session.resumenoneResume a session
app.session.toggleNamedFilterctrl+nToggle named session filter
app.session.togglePathctrl+pToggle session path display
app.session.toggleSortctrl+sToggle session sort mode
app.session.treenoneOpen session tree
app.suspendctrl+zSuspend to background

Editing and messages

Action
Default key
Effect
app.clipboard.pasteImagectrl+vPaste image from clipboard (text fallback)
app.editor.externalctrl+gOpen external editor
app.message.copyctrl+xCopy selection or last assistant message
app.message.dequeuealt+upRestore queued messages
app.message.followUpalt+enterQueue follow-up message

Models

Action
Default key
Effect
app.model.cycleBackwardshift+ctrl+pCycle to previous model
app.model.cycleForwardctrl+pCycle to next model
app.model.selectctrl+lOpen model selector
app.models.clearAllctrl+xClear all models
app.models.enableAllctrl+aEnable all models
app.models.reorderDownalt+downMove model down in order
app.models.reorderUpalt+upMove model up in order
app.models.savectrl+sSave model selection
app.models.toggleProviderctrl+pToggle all models for provider
app.thinking.savectrl+sSave the selected thinking level as the default, in the thinking level selector

Display

Action
Default key
Effect
app.thinking.cycleshift+tabCycle thinking level
app.thinking.togglectrl+tToggle thinking blocks
app.tools.expandctrl+oToggle tool details

Session tree

Action
Default key
Effect
app.tree.editLabelshift+lEdit tree label
app.tree.filter.allctrl+aTree filter: show all entries
app.tree.filter.cycleBackwardshift+ctrl+oTree filter: cycle backward
app.tree.filter.cycleForwardctrl+oTree filter: cycle forward
app.tree.filter.defaultctrl+dTree filter: default view
app.tree.filter.labeledOnlyctrl+lTree filter: labeled entries only
app.tree.filter.noToolsctrl+tTree filter: hide tool results
app.tree.filter.userOnlyctrl+uTree filter: user messages only
app.tree.foldOrUpalt+left, ctrl+leftFold tree branch or move up
app.tree.toggleLabelTimestampshift+tToggle tree label timestamps
app.tree.unfoldOrDownalt+right, ctrl+rightUnfold tree branch or move down

Several actions share a key, such as ctrl+s for app.session.toggleSort, app.models.save and app.thinking.save. Each one applies only in its own selector, so they do not conflict.

Terminal UI actions

Actions named tui.* control the editor, lists, and the fullscreen transcript. Rebind them in keybindings.json the same way as app.* actions.

Cursor movement

Action
Default key
Effect
tui.editor.cursorUpupMove cursor up, or browse older history at the top
tui.editor.cursorDowndownMove cursor down, or browse newer history at the bottom
tui.editor.historyPreviousnoneSelect the previous prompt history entry
tui.editor.historyNextnoneSelect the next prompt history entry
tui.editor.cursorLeftleft, ctrl+bMove cursor left
tui.editor.cursorRightright, ctrl+fMove cursor right
tui.editor.cursorWordLeftalt+left, ctrl+left, alt+bMove cursor one word left
tui.editor.cursorWordRightalt+right, ctrl+right, alt+fMove cursor one word right
tui.editor.cursorLineStarthome, ctrl+home, ctrl+aMove to line start
tui.editor.cursorLineEndend, ctrl+end, ctrl+eMove to line end
tui.editor.jumpForwardctrl+]Jump forward to a character
tui.editor.jumpBackwardctrl+alt+]Jump backward to a character
tui.editor.pageUppageUp, ctrl+pageUpScroll the editor up one page
tui.editor.pageDownpageDown, ctrl+pageDownScroll the editor down one page

Text editing

Action
Default key
Effect
tui.editor.deleteCharBackwardbackspaceDelete character backward
tui.editor.deleteCharForwarddelete, ctrl+dDelete character forward
tui.editor.deleteWordBackwardctrl+w, alt+backspaceDelete word backward
tui.editor.deleteWordForwardalt+d, alt+deleteDelete word forward
tui.editor.deleteToLineStartctrl+uDelete to line start
tui.editor.deleteToLineEndctrl+kDelete to line end
tui.editor.yankctrl+yPaste the most recently deleted text
tui.editor.yankPopalt+yCycle through deleted text after a yank
tui.editor.undoctrl+-Undo the last edit

Input and selection

Action
Default key
Effect
tui.input.newLineshift+enter, ctrl+jInsert a new line
tui.input.submitenterSubmit input
tui.input.tabtabTab or autocomplete
tui.input.copyctrl+cCopy selection
tui.select.upupMove selection up
tui.select.downdownMove selection down
tui.select.pageUppageUpPage up in a list
tui.select.pageDownpageDownPage down in a list
tui.select.confirmenterConfirm selection
tui.select.cancelescape, ctrl+cCancel selection

Fullscreen transcript

These actions apply when tuiMode is fullscreen. They take precedence over editor actions that use the same key.

Action
Default key
Effect
tui.altScreen.pageUppageUpScroll the transcript up one page
tui.altScreen.pageDownpageDownScroll the transcript down one page
tui.altScreen.halfPageUpnoneScroll the transcript up half a page
tui.altScreen.halfPageDownnoneScroll the transcript down half a page
tui.altScreen.lineUpnoneScroll the transcript up one line
tui.altScreen.lineDownnoneScroll the transcript down one line
tui.altScreen.previousPromptctrl+shift+up, ctrl+upJump to the previous prompt
tui.altScreen.nextPromptctrl+shift+down, ctrl+downJump to the next prompt
tui.altScreen.searchctrl+shift+fSearch the transcript
tui.altScreen.searchNextenter, ctrl+gSelect the next match while searching
tui.altScreen.searchPreviousshift+enter, ctrl+shift+gSelect the previous match while searching
tui.altScreen.searchCloseescapeClose transcript search
tui.altScreen.tophomeScroll to the start of the transcript
tui.altScreen.bottomendScroll to the end of the transcript and follow new output

Platform differences

Some actions use a different key on each platform, because the terminal or the operating system reserves the macOS key. WSL uses the Windows keys, except that ctrl+z still suspends and alt+z undoes. PiG detects WSL from WSL_DISTRO_NAME or WSL_INTEROP.

Action
macOS
Linux
WSL
Windows
app.clipboard.pasteImagectrl+vctrl+valt+valt+v
app.suspendctrl+zctrl+zctrl+znone
app.message.dequeuealt+upalt+upalt+qalt+q
app.message.followUpalt+enteralt+enterctrl+qctrl+q
app.model.cycleBackwardshift+ctrl+pshift+ctrl+palt+palt+p
app.tree.foldOrUpalt+left, ctrl+leftctrl+left, alt+leftctrl+left, alt+leftctrl+left, alt+left
app.tree.unfoldOrDownalt+right, ctrl+rightctrl+right, alt+rightctrl+right, alt+rightctrl+right, alt+right
tui.editor.undoctrl+-ctrl+-alt+zctrl+z
tui.altScreen.previousPromptctrl+shift+up, ctrl+upctrl+shift+up, ctrl+upctrl+upctrl+up
tui.altScreen.nextPromptctrl+shift+down, ctrl+downctrl+shift+down, ctrl+downctrl+downctrl+down
tui.altScreen.searchctrl+shift+fctrl+shift+fctrl+fctrl+f

Actions with no default key

These actions exist but have no key until you assign one. Reach them with their slash command, or bind them in keybindings.json.

Action
Slash command
app.session.fork/fork
app.session.new/new
app.session.resume/resume
app.session.tree/tree

Key names

Write a key as its name, or as modifiers joined to the name with +. Use ctrl, alt and shift for modifiers. Examples: ctrl+o, shift+ctrl+p, alt+enter, escape, ctrl+backspace.

Terminals do not all report the same keys. If a binding does not respond, the terminal usually consumed the key before PiG saw it. See terminal setup.

Adapted from upstream Pi documentation · Upstream documentation ↗ · MIT License