User guide / Terminals

Moving text in and out

Development reference · View source

Out of a terminal. Space t y (:terminal-output) copies the session into an ordinary read-only buffer. That is real text: search, multiple selections, n/N, and yank all work. Ctrl-o or Alt-o returns to the terminal, and Ctrl-i or Alt-i goes back to the output.

Into a terminal. Write the text in an ordinary buffer, with every editing command available — multiple cursors above all — then Space t s (:terminal-send [number|name]) sends the selection to a terminal as one bracketed paste, or the whole buffer when nothing is selected.

This is the only way modal editing can reach a program that owns its input area, and it is what makes long prompts for a coding agent worth writing in the editor.

Example: write a prompt for an agent running in terminal 2.

  1. Space b n — open a scratch buffer, then i and write the prompt.
  2. Escape — back to Normal mode, with nothing selected.
  3. :terminal-send 2 — paste the whole buffer into terminal 2.
  4. Switch to the terminal and press Enter there to submit.