Skip to content
ƒtsforgev0.57.1
38

Input Editor

5 min read

The tsforge CLI uses an interactive multi-line input editor for the REPL session. It supports full keyboard navigation, history recall, word deletion, and multi-line paste.

KeyBehavior
EnterSubmit message to the agent
Shift+EnterInsert newline in buffer
Alt+EnterInsert newline in buffer
\ then EnterInsert newline (remove the trailing backslash)

When you press Enter with an empty buffer or at the top level, your message is submitted. To write multiple lines, use Shift+Enter, Alt+Enter, or end a line with a backslash and press Enter.

KeyAction
←/→Move cursor left/right (one character)
Ctrl+← / Ctrl+→Move by word
Home / EndMove to start/end of current line
Ctrl+Home / Ctrl+EndMove to start/end of entire buffer
↑/↓Recall input history (at buffer edges only)
KeyAction
BackspaceDelete character before cursor
DeleteDelete character at cursor
Ctrl+WDelete word before cursor
Alt+BackspaceDelete word before cursor (alias)
Ctrl+UDelete to start of line
Ctrl+KDelete to end of line
KeyAction
Ctrl+YYank (paste) last deleted text
Alt+YYank-pop (rotate through deleted text)
KeyAction
Ctrl+_ (Ctrl+underscore)Undo last change

When your cursor is at the top of the buffer (line 0, any column), press ↑ to recall the previous submitted message. When at the bottom (last line), press ↓ to scroll forward through history. The draft you were typing is preserved and restored when you exit history.

Paste a block of text with your terminal’s paste (⌘V on macOS / Ctrl+Shift+V on Linux). The terminal delivers it as a bracketed paste. The pasted content lands in the buffer as-is and may span multiple lines; edit it like any buffer text. When you press Enter, the entire buffer (including pasted lines) is submitted as a single message.

Very large pastes are displayed as [paste #N +M lines] in the UI and expand to their full content when sent.

Requires a vision capability configured. Three ways to attach an image; each is sent to the vision backend and its text description is folded into your message (the chat model stays text-only):

MethodAction
Ctrl+VPaste an image from the clipboard. A 📋 reading clipboard… hint shows during the read, then an [image #N] chip lands in the buffer. (Falls back to pasting clipboard text if there’s no image.)
Drag & dropDrag an image file onto the terminal. It drops the path, which is attached on send.
@ mention@path/to/image.png: the picker lists image files too. When the project has a tsconfig.json, typing an identifier (e.g. @ITh) also surfaces workspace symbols — accept inserts @file:line as a steer-friendly anchor. Path queries (e.g. @src/) stay file-only.

Why Ctrl+V, not ⌘V: the terminal emulator intercepts ⌘V and, for an image, hands the app nothing. A terminal program can only receive Ctrl+V (a real control byte). Identical images attached more than once are described once (no duplicate cost). See also generating images.

KeyAction
/Open command palette (when buffer contains only /)
@Open mention picker (when buffer contains only @)

Typing / or @ followed by other text opens inline completion above the editor block. For @:

  • Files — filter by path substring; accept inserts @path (unchanged).
  • Symbols — when a tsconfig.json is present and your query looks like an identifier (IThing, fetchUser), LSP workspace symbols appear alongside files; accept inserts @file:line so you can steer the agent to a definition or use site.
  • Ranking — symbol prefix match, then file basename prefix, then substring matches (capped at 8 rows, same as files).

Withhold symbol search in the picker with TSFORGE_NO_LSP_TOOLS=1 (file-only behavior, same as eval/headless runs).

An @ mid-token (e.g. in an email address) does not open the picker — only @ at the start of the line or after whitespace does.

When the right rail is on the Gate surface and focused, Enter on a selected error row inserts steer text into the prompt (fix <rule> at <file>:line) and returns focus to the editor — same handoff as accepting an @ symbol, but anchored on the gate error you picked.

KeyAction
Ctrl+CInterrupt the current model run (does not exit the session)
Ctrl+DExit the CLI (on empty buffer only)

If the multi-line editor has compatibility issues, you can fall back to simple single-line (readline) input:

Terminal window
TSFORGE_BASIC_INPUT=1 tsforge

This mode still accepts slash commands and works in pipes, but does not support Shift+Enter, multi-line paste, or kill-ring operations.

The editor auto-detects your terminal’s keyboard encoding (Kitty CSI-u, xterm modifyOtherKeys, or legacy). Resizing your terminal window updates the editor immediately. On non-TTY streams (pipes, files, CI), the editor is automatically skipped and replaced by line-buffered stdin reading.