From 5e825543dc55a2c649e68dce6341844ad71fa217 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 8 Feb 2026 11:14:36 +0200 Subject: add hexai-tmux-edit: tmux popup editor for AI agent prompts New tool that opens $EDITOR in a tmux popup for composing longer prompts when working with AI CLI agents (Claude Code, Cursor, Amp, Aider, etc.). Captures existing prompt text from the target pane, pre-fills the editor, and sends edited text back via tmux send-keys. Config-driven agent detection via regex patterns in [tmux_edit] config section. Co-Authored-By: Claude Opus 4.6 --- internal/tmuxedit/capture.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 internal/tmuxedit/capture.go (limited to 'internal/tmuxedit/capture.go') diff --git a/internal/tmuxedit/capture.go b/internal/tmuxedit/capture.go new file mode 100644 index 0000000..2af5698 --- /dev/null +++ b/internal/tmuxedit/capture.go @@ -0,0 +1,17 @@ +package tmuxedit + +import ( + "fmt" + "strings" +) + +// capturePane retrieves the visible content of a tmux pane via +// `tmux capture-pane -p -t `. The -p flag prints to stdout +// instead of to a paste buffer. +var capturePane = func(paneID string) (string, error) { + out, err := runCommand("tmux", "capture-pane", "-p", "-t", paneID) + if err != nil { + return "", fmt.Errorf("capture-pane failed for %s: %w", paneID, err) + } + return strings.TrimRight(string(out), "\n"), nil +} -- cgit v1.2.3