Skip to content

Copy and Paste

Saumyadip edited this page Nov 6, 2026 · 2 revisions

Copy and Paste

Ananta keeps one clipboard per session (the clip buffer).

πŸ“Έ Screenshot coming here: The bar flashing "copied N chars" after a selection. 🎬 Video coming here: Copying with the mouse and pasting into another pane.

Getting text out

Any copy path (mouse drag, copy mode y, Enter) ends in copyText:

  1. OSC 52 β€” the escape sequence ESC ] 52;c;<base64> BEL is written to your terminal, so the clipboard lands wherever you actually sit. This works great over SSH and out of the box with kitty, foot, wezterm, ghostty, alacritty, …
  2. Native tool fallback β€” in parallel: wl-copy, xclip -selection clipboard, xsel, termux-clipboard-set, pbcopy β€” the first one found in $PATH is used.
  3. The text is kept in the session for paste, and the bar flashes copied N chars.

πŸ“Έ Screenshot coming here: The bar showing "copied 42 chars". 🎬 Video coming here: Copying text with a mouse drag and seeing it land in your system clipboard.

Getting text in

alt+p (paste):

  1. If the session has a recorded clip, it is written to the focused pane.
  2. Otherwise a native tool is read back (wl-paste, xclip -out, xsel --output, termux-clipboard-get, pbpaste; empty output falls back with a nothing to paste nudge).

Line endings are converted to carriage returns (\r) so a multi-line paste runs naturally through shells and editors.

mouse: drag inside a pane β€” release copies
alt+y  β†’ copy the selection in copy mode
alt+p  β†’ paste into the focused pane

πŸ“Έ Screenshot coming here: Pasting text into a pane with alt+p. 🎬 Video coming here: Copying in one pane and pasting in another.

Because the client terminal is involved

  • OSC 52 is a client-side feature: it requires your terminal to accept clipboard requests. In constrained terminals it is often gated behind an option (kitty: allow_remote_control; foot: osc52-*).
  • Native tools copy on the server host β€” where the panes run. Over SSH, the OSC 52 path is the only one that reaches your physical machine; the wl-copy path copies on the remote.
  • Bracketed paste mode is not emulated into panes yet β€” shells that expect it still work, they just do not highlight the paste.

🎬 Video coming here: Copying over SSH and having it appear on your local clipboard via OSC 52.

Clone this wiki locally