diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-01 20:25:07 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-01 20:25:07 +0200 |
| commit | 72dd772c7a5627aea6564185d4ef73823606aee5 (patch) | |
| tree | 31e67b35d5e1e34a9b66b123a61cfa437619087e | |
| parent | c66343f3e3bfd06ef8f971e06f762734fc1b56d4 (diff) | |
Update content for md
| -rw-r--r-- | about/resources.md | 208 | ||||
| -rw-r--r-- | gemfeed/2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md | 288 | ||||
| -rw-r--r-- | gemfeed/index.md | 1 | ||||
| -rw-r--r-- | gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo1.png | bin | 0 -> 66443 bytes | |||
| -rw-r--r-- | gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo2.png | bin | 0 -> 79061 bytes | |||
| -rw-r--r-- | index.md | 3 | ||||
| -rw-r--r-- | uptime-stats.md | 2 |
7 files changed, 396 insertions, 106 deletions
diff --git a/about/resources.md b/about/resources.md index c2c6d3fe..750a1843 100644 --- a/about/resources.md +++ b/about/resources.md @@ -35,110 +35,110 @@ You won't find any links on this site because, over time, the links will break. In random order: -* DNS and BIND; Cricket Liu; O'Reilly -* 21st Century C: C Tips from the New School; Ben Klemens; O'Reilly -* DevOps And Site Reliability Engineering Handbook; Stephen Fleming; Audible -* C++ Programming Language; Bjarne Stroustrup; -* The DevOps Handbook; Gene Kim, Jez Humble, Patrick Debois, John Willis; Audible -* Clusterbau mit Linux-HA; Michael Schwartzkopff; O'Reilly -* Chaos Engineering - System Resiliency in Practice; Casey Rosenthal and Nora Jones; eBook -* Amazon Web Services in Action; Michael Wittig and Andreas Wittig; Manning Publications -* Data Science at the Command Line; Jeroen Janssens; O'Reilly +* Polished Ruby Programming; Jeremy Evans; Packt Publishing +* 100 Go Mistakes and How to Avoid Them; Teiva Harsanyi; Manning Publications +* Effective Java; Joshua Bloch; Addison-Wesley Professional +* Distributed Systems: Principles and Paradigms; Andrew S. Tanenbaum; Pearson +* Go Brain Teasers - Exercise Your Mind; Miki Tebeka; The Pragmatic Programmers * Raku Recipes; J.J. Merelo; Apress -* Programming Ruby 3.3 (5th Edition); Noel Rappin, with Dave Thomas; The Pragmatic Bookshelf -* Concurrency in Go; Katherine Cox-Buday; O'Reilly +* Effective awk programming; Arnold Robbins; O'Reilly +* Systemprogrammierung in Go; Frank Müller; dpunkt * Hands-on Infrastructure Monitoring with Prometheus; Joel Bastos, Pedro Araujo; Packt -* Higher Order Perl; Mark Dominus; Morgan Kaufmann -* Learn You Some Erlang for Great Good; Fred Herbert; No Starch Press * Kubernetes Cookbook; Sameer Naik, Sébastien Goasguen, Jonathan Michaux; O'Reilly -* The Pragmatic Programmer; David Thomas; Addison-Wesley -* Effective Java; Joshua Bloch; Addison-Wesley Professional -* Developing Games in Java; David Brackeen and others...; New Riders -* The Practise of System and Network Administration; Thomas A. Limoncelli, Christina J. Hogan, Strata R. Chalup; Addison-Wesley Professional Pro Git; Scott Chacon, Ben Straub; Apress -* Effective awk programming; Arnold Robbins; O'Reilly * Seeking SRE: Conversations About Running Production Systems at Scale; David N. Blank-Edelman; eBook -* Think Raku (aka Think Perl 6); Laurent Rosenfeld, Allen B. Downey; O'Reilly -* The Go Programming Language; Alan A. A. Donovan; Addison-Wesley Professional -* Object-Oriented Programming with ANSI-C; Axel-Tobias Schreiner -* Perl New Features; Joshua McAdams, brian d foy; Perl School -* Systemprogrammierung in Go; Frank Müller; dpunkt -* Programming Perl aka "The Camel Book"; Tom Christiansen, brian d foy, Larry Wall & Jon Orwant; O'Reilly -* The Docker Book; James Turnbull; Kindle -* Terraform Cookbook; Mikael Krief; Packt Publishing +* Higher Order Perl; Mark Dominus; Morgan Kaufmann +* Data Science at the Command Line; Jeroen Janssens; O'Reilly * 97 things every SRE should know; Emil Stolarsky, Jaime Woo; O'Reilly -* Funktionale Programmierung; Peter Pepper; Springer -* The KCNA (Kubernetes and Cloud Native Associate) Book; Nigel Poulton +* Systems Performance Tuning; Gian-Paolo D. Musumeci and others...; O'Reilly +* The Practise of System and Network Administration; Thomas A. Limoncelli, Christina J. Hogan, Strata R. Chalup; Addison-Wesley Professional Pro Git; Scott Chacon, Ben Straub; Apress +* Raku Fundamentals; Moritz Lenz; Apress +* Terraform Cookbook; Mikael Krief; Packt Publishing +* The Pragmatic Programmer; David Thomas; Addison-Wesley +* DevOps And Site Reliability Engineering Handbook; Stephen Fleming; Audible * Leanring eBPF; Liz Rice; O'Reilly +* Chaos Engineering - System Resiliency in Practice; Casey Rosenthal and Nora Jones; eBook +* C++ Programming Language; Bjarne Stroustrup; +* Amazon Web Services in Action; Michael Wittig and Andreas Wittig; Manning Publications +* Clusterbau mit Linux-HA; Michael Schwartzkopff; O'Reilly +* Site Reliability Engineering; How Google runs production systems; O'Reilly +* The DevOps Handbook; Gene Kim, Jez Humble, Patrick Debois, John Willis; Audible +* Programming Ruby 3.3 (5th Edition); Noel Rappin, with Dave Thomas; The Pragmatic Bookshelf +* 21st Century C: C Tips from the New School; Ben Klemens; O'Reilly * Learn You a Haskell for Great Good!; Miran Lipovaca; No Starch Press -* Raku Fundamentals; Moritz Lenz; Apress -* Pro Puppet; James Turnbull, Jeffrey McCune; Apress -* Go Brain Teasers - Exercise Your Mind; Miki Tebeka; The Pragmatic Programmers -* Polished Ruby Programming; Jeremy Evans; Packt Publishing +* Modern Perl; Chromatic ; Onyx Neon Press +* Perl New Features; Joshua McAdams, brian d foy; Perl School * Java ist auch eine Insel; Christian Ullenboom; -* The Kubernetes Book; Nigel Poulton; Unabridged Audiobook -* Ultimate Go Notebook; Bill Kennedy +* Pro Puppet; James Turnbull, Jeffrey McCune; Apress +* The Go Programming Language; Alan A. A. Donovan; Addison-Wesley Professional +* The KCNA (Kubernetes and Cloud Native Associate) Book; Nigel Poulton * Tmux 2: Productive Mouse-free Development; Brain P. Hogan; The Pragmatic Programmers -* Distributed Systems: Principles and Paradigms; Andrew S. Tanenbaum; Pearson -* Systems Performance Tuning; Gian-Paolo D. Musumeci and others...; O'Reilly -* 100 Go Mistakes and How to Avoid Them; Teiva Harsanyi; Manning Publications -* Site Reliability Engineering; How Google runs production systems; O'Reilly -* Modern Perl; Chromatic ; Onyx Neon Press +* Funktionale Programmierung; Peter Pepper; Springer +* Developing Games in Java; David Brackeen and others...; New Riders +* Ultimate Go Notebook; Bill Kennedy +* The Docker Book; James Turnbull; Kindle +* Learn You Some Erlang for Great Good; Fred Herbert; No Starch Press +* Programming Perl aka "The Camel Book"; Tom Christiansen, brian d foy, Larry Wall & Jon Orwant; O'Reilly +* Object-Oriented Programming with ANSI-C; Axel-Tobias Schreiner +* Concurrency in Go; Katherine Cox-Buday; O'Reilly +* Think Raku (aka Think Perl 6); Laurent Rosenfeld, Allen B. Downey; O'Reilly +* DNS and BIND; Cricket Liu; O'Reilly +* The Kubernetes Book; Nigel Poulton; Unabridged Audiobook ## Technical references I didn't read them from the beginning to the end, but I am using them to look up things. The books are in random order: +* Groovy Kurz & Gut; Joerg Staudemeier; O'Reilly +* The Linux Programming Interface; Michael Kerrisk; No Starch Press * Understanding the Linux Kernel; Daniel P. Bovet, Marco Cesati; O'Reilly +* Implementing Service Level Objectives; Alex Hidalgo; O'Reilly * BPF Performance Tools - Linux System and Application Observability, Brendan Gregg; Addison Wesley -* The Linux Programming Interface; Michael Kerrisk; No Starch Press * Relayd and Httpd Mastery; Michael W Lucas -* Groovy Kurz & Gut; Joerg Staudemeier; O'Reilly -* Go: Design Patterns for Real-World Projects; Mat Ryer; Packt -* Implementing Service Level Objectives; Alex Hidalgo; O'Reilly * Algorithms; Robert Sedgewick, Kevin Wayne; Addison Wesley +* Go: Design Patterns for Real-World Projects; Mat Ryer; Packt ## Self-development and soft-skills books In random order: -* Influence without Authority; A. Cohen, D. Bradford; Wiley +* Buddah and Einstein walk into a Bar; Guy Joseph Ale, Claire Bloom; Blackstone Publishing +* Solve for Happy; Mo Gawdat (RE-READ 1ST TIME) +* The Courage to Be Disliked; Ichiro Kishimi and Fumitake Koga; Audiobook +* The Daily Stoic; Ryan Holiday, Stephen Hanselman; Profile Books +* Soft Skills; John Sommez; Manning Publications +* The Complete Software Developer's Career Guide; John Sonmez; Unabridged Audiobook +* Getting Things Done; David Allen * Slow Productivity; Cal Newport; Penguin Random House -* Psycho-Cybernetics; Maxwell Maltz; Perigee Books -* Who Moved My Cheese?; Dr. Spencer Johnson; Vermilion +* Never Split the Difference; Chris Voss, Tahl Raz; Random House Business +* The 7 Habits Of Highly Effective People; Stephen R. Covey; Simon & Schuster UK +* The Power of Now; Eckhard Tolle; Yellow Kite * Atomic Habits; James Clear; Random House Business -* The Daily Stoic; Ryan Holiday, Stephen Hanselman; Profile Books -* Ultralearning; Scott Young; Thorsons -* The Off Switch; Mark Cropley; Virgin Books (RE-READ 1ST TIME) -* 97 Things Every Engineering Manager Should Know; Camille Fournier; Audiobook -* The Joy of Missing Out; Christina Crook; New Society Publishers -* So Good They Can't Ignore You; Cal Newport; Business Plus * Search Inside Yourself - The Unexpected path to Achieving Success, Happiness (and World Peace); Chade-Meng Tan, Daniel Goleman, Jon Kabat-Zinn; HarperOne -* Never Split the Difference; Chris Voss, Tahl Raz; Random House Business -* Buddah and Einstein walk into a Bar; Guy Joseph Ale, Claire Bloom; Blackstone Publishing -* The Obstacle Is The Way; Ryan Holiday; Profile Books Ltd +* Psycho-Cybernetics; Maxwell Maltz; Perigee Books +* Stop starting, start finishing; Arne Roock; Lean-Kanban University * The Software Engineer's Guidebook: Navigating senior, tech lead, and staff engineer positions at tech companies and startups; Gergely Orosz; Audiobook -* Digital Minimalism; Cal Newport; Portofolio Penguin -* Eat That Frog!; Brian Tracy; Hodder Paperbacks -* The Courage to Be Disliked; Ichiro Kishimi and Fumitake Koga; Audiobook -* Deep Work; Cal Newport; Piatkus * Consciousness: A Very Short Introduction; Susan Blackmore; Oxford Uiversity Press -* The Good Enough Job; Simone Stolzoff; Ebury Edge -* Solve for Happy; Mo Gawdat (RE-READ 1ST TIME) -* Staff Engineer: Leadership beyond the management track; Will Larson; Audiobook -* Time Management for System Administrators; Thomas A. Limoncelli; O'Reilly -* Ultralearning; Anna Laurent; Self-published via Amazon -* The 7 Habits Of Highly Effective People; Stephen R. Covey; Simon & Schuster UK +* The Bullet Journal Method; Ryder Carroll; Fourth Estate +* Who Moved My Cheese?; Dr. Spencer Johnson; Vermilion * Eat That Frog; Brian Tracy +* 97 Things Every Engineering Manager Should Know; Camille Fournier; Audiobook +* The Phoenix Project - A Novel About IT, DevOps, and Helping your Business Win; Gene Kim and Kevin Behr; Trade Select +* The Off Switch; Mark Cropley; Virgin Books (RE-READ 1ST TIME) +* Influence without Authority; A. Cohen, D. Bradford; Wiley +* Deep Work; Cal Newport; Piatkus +* Ultralearning; Scott Young; Thorsons * Meditation for Mortals, Oliver Burkeman, Audiobook +* Ultralearning; Anna Laurent; Self-published via Amazon * Coders at Work - Reflections on the craft of programming, Peter Seibel and Mitchell Dorian et al., Audiobook -* Stop starting, start finishing; Arne Roock; Lean-Kanban University -* Soft Skills; John Sommez; Manning Publications -* The Complete Software Developer's Career Guide; John Sonmez; Unabridged Audiobook -* Getting Things Done; David Allen +* Eat That Frog!; Brian Tracy; Hodder Paperbacks * 101 Essays that change the way you think; Brianna Wiest; Audiobook -* The Bullet Journal Method; Ryder Carroll; Fourth Estate -* The Power of Now; Eckhard Tolle; Yellow Kite -* The Phoenix Project - A Novel About IT, DevOps, and Helping your Business Win; Gene Kim and Kevin Behr; Trade Select +* Digital Minimalism; Cal Newport; Portofolio Penguin +* The Joy of Missing Out; Christina Crook; New Society Publishers +* The Obstacle Is The Way; Ryan Holiday; Profile Books Ltd +* So Good They Can't Ignore You; Cal Newport; Business Plus +* Time Management for System Administrators; Thomas A. Limoncelli; O'Reilly +* The Good Enough Job; Simone Stolzoff; Ebury Edge +* Staff Engineer: Leadership beyond the management track; Will Larson; Audiobook [Here are notes of mine for some of the books](../notes/index.md) @@ -146,30 +146,30 @@ In random order: Some of these were in-person with exams; others were online learning lectures only. In random order: -* Functional programming lecture; Remote University of Hagen * Structure and Interpretation of Computer Programs; Harold Abelson and more...; -* F5 Loadbalancers Training; 2-day on-site training; F5, Inc. -* The Ultimate Kubernetes Bootcamp; School of Devops; O'Reilly Online -* Apache Tomcat Best Practises; 3-day on-site training +* Developing IaC with Terraform (with Live Lessons); O'Reilly Online * MySQL Deep Dive Workshop; 2-day on-site training -* Ultimate Go Programming; Bill Kennedy; O'Reilly Online -* Linux Security and Isolation APIs Training; Michael Kerrisk; 3-day on-site training +* Functional programming lecture; Remote University of Hagen * Cloud Operations on AWS - Learn how to configure, deploy, maintain, and troubleshoot your AWS environments; 3-day online live training with labs; Amazon +* The Ultimate Kubernetes Bootcamp; School of Devops; O'Reilly Online +* Ultimate Go Programming; Bill Kennedy; O'Reilly Online * Protocol buffers; O'Reilly Online -* Red Hat Certified System Administrator; Course + certification (Although I had the option, I decided not to take the next course as it is more effective to self learn what I need) -* The Well-Grounded Rubyist Video Edition; David. A. Black; O'Reilly Online * Scripting Vim; Damian Conway; O'Reilly Online -* Developing IaC with Terraform (with Live Lessons); O'Reilly Online -* AWS Immersion Day; Amazon; 1-day interactive online training +* Apache Tomcat Best Practises; 3-day on-site training * Algorithms Video Lectures; Robert Sedgewick; O'Reilly Online +* AWS Immersion Day; Amazon; 1-day interactive online training +* Linux Security and Isolation APIs Training; Michael Kerrisk; 3-day on-site training +* Red Hat Certified System Administrator; Course + certification (Although I had the option, I decided not to take the next course as it is more effective to self learn what I need) +* The Well-Grounded Rubyist Video Edition; David. A. Black; O'Reilly Online +* F5 Loadbalancers Training; 2-day on-site training; F5, Inc. ## Technical guides These are not whole books, but guides (smaller or larger) which I found very useful. in random order: +* Raku Guide at https://raku.guide * Advanced Bash-Scripting Guide * How CPUs work at https://cpu.land -* Raku Guide at https://raku.guide ## Podcasts @@ -177,58 +177,58 @@ These are not whole books, but guides (smaller or larger) which I found very use In random order: -* Hidden Brain -* Cup o' Go [Golang] -* BSD Now [BSD] -* Pratical AI -* Deep Questions with Cal Newport * The ProdCast (Google SRE Podcast) -* Wednesday Wisdom +* Modern Mentor * The Pragmatic Engineer Podcast +* Deep Questions with Cal Newport +* The Changelog Podcast(s) * Fallthrough [Golang] -* Modern Mentor -* Fork Around And Find Out -* Backend Banter -* Dev Interrupted +* BSD Now [BSD] +* Wednesday Wisdom +* Pratical AI +* Hidden Brain * Maintainable -* The Changelog Podcast(s) +* Cup o' Go [Golang] +* Dev Interrupted +* Backend Banter +* Fork Around And Find Out ### Podcasts I liked I liked them but am not listening to them anymore. The podcasts have either "finished" (no more episodes) or I stopped listening to them due to time constraints or a shift in my interests. -* Go Time (predecessor of fallthrough) +* Java Pub House * FLOSS weekly +* Go Time (predecessor of fallthrough) * CRE: Chaosradio Express [german] * Modern Mentor * Ship It (predecessor of Fork Around And Find Out) -* Java Pub House ## Newsletters I like This is a mix of tech and non-tech newsletters I am subscribed to. In random order: -* Changelog News -* VK Newsletter +* Monospace Mentor * The Imperfectionist -* Andreas Brandhorst Newsletter (Sci-Fi author) +* The Valuable Dev +* VK Newsletter * The Pragmatic Engineer +* byteSizeGo +* Golang Weekly * Register Spill +* Changelog News * Applied Go Weekly Newsletter -* Golang Weekly -* Monospace Mentor -* The Valuable Dev -* byteSizeGo * Ruby Weekly +* Andreas Brandhorst Newsletter (Sci-Fi author) ## Magazines I like(d) This is a mix of tech I like(d). I may not be a current subscriber, but now and then, I buy an issue. In random order: * freeX (not published anymore) -* Linux User * LWN (online only) * Linux Magazine +* Linux User # Formal education diff --git a/gemfeed/2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md b/gemfeed/2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md new file mode 100644 index 00000000..da120522 --- /dev/null +++ b/gemfeed/2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md @@ -0,0 +1,288 @@ +# A tmux popup editor for Cursor Agent prompts + +> Published at 2026-02-01T20:24:16+02:00 + +...and any other TUI based application + +## Table of Contents + +* [⇢ A tmux popup editor for Cursor Agent prompts](#a-tmux-popup-editor-for-cursor-agent-prompts) +* [⇢ ⇢ Why I built this](#why-i-built-this) +* [⇢ ⇢ What it is](#what-it-is) +* [⇢ ⇢ How it works (overview)](#how-it-works-overview) +* [⇢ ⇢ Challenges and small discoveries](#challenges-and-small-discoveries) +* [⇢ ⇢ Test cases (for a future rewrite)](#test-cases-for-a-future-rewrite) +* [⇢ ⇢ (Almost) works with any editor (or any TUI)](#almost-works-with-any-editor-or-any-tui) + +## Why I built this + +I spend some time in Cursor Agent (the CLI version of the Cursor IDE, I don't like really the IDE), and I also jump between Claude Code CLI, Ampcode, Gemini CLI, OpenAI Codex CLI, OpenCode, and Aider just to see how things are evolving. But for the next month I'll be with Cursor Agent. + +Short prompts are fine in the inline input, but for longer prompts I want a real editor: spellcheck, search/replace, multiple cursors, and all the Helix muscle memory I already have. + +Cursor Agent has a Vim editing mode, but not Helix. And even in Vim mode I can't use my full editor setup. I want the real thing, not a partial emulation. + +[https://helix-editor.com](https://helix-editor.com) +[https://www.vim.org](https://www.vim.org) +[https://neovim.io](https://neovim.io) + +So I built a tiny tmux popup editor. It opens `$EDITOR` (Helix for me), and when I close it, the buffer is sent back into the prompt. It sounds simple, but it feels surprisingly native. + +This is how it looks like: + +[](./tmux-popup-editor-for-cursor-agent-prompts/demo1.png) + +## What it is + +The idea is straightforward: + +* A tmux key binding `prefix-e` opens a popup overlay near the bottom of the screen. +* The popup starts `$EDITOR` on a temp file. +* When I exit the editor, the script sends the contents back to the original pane with `tmux send-keys`. + +It also pre-fills the temp file with whatever is already typed after Cursor Agent's `→` prompt, so I can continue where I left off. + +## How it works (overview) + +This is the tmux binding I use (trimmed to the essentials): + +``` +bind-key e run-shell -b "tmux display-message -p '#{pane_id}' + > /tmp/tmux-edit-target-#{client_pid} \; + tmux popup -E -w 90% -h 35% -x 5% -y 65% -d '#{pane_current_path}' + \"~/scripts/tmux-edit-send /tmp/tmux-edit-target-#{client_pid}\"" +``` + +And this is how it looks like after sending back the text to the Cursor Agent's input: + +[](./tmux-popup-editor-for-cursor-agent-prompts/demo2.png) + +And here is the full script. It is a bit ugly since it's shell (written with Cursor Agent with GPT-5.2-Codex), and I might (let) rewrite it in Go and release it once I have time. But it works well enough for now. + +```bash +#!/usr/bin/env bash +set -u -o pipefail + +declare -i LOG_ENABLED=0 + +log_file="${TMPDIR:-/tmp}/tmux-edit-send.log" + +log() { + if [ "$LOG_ENABLED" -eq 1 ]; then + printf '%s\n' "$*" >> "$log_file" + fi +} + +# Read the target pane id from a temp file created by tmux binding. +read_target_from_file() { + local file_path="$1" + if [ -n "$file_path" ] && [ -f "$file_path" ]; then + sed -n '1p' "$file_path" | tr -d '[:space:]' + fi +} + +# Read the target pane id from tmux environment if present. +read_target_from_env() { + local env_line + env_line="$(tmux show-environment -g TMUX_EDIT_TARGET 2>/dev/null || true)" + case "$env_line" in + TMUX_EDIT_TARGET=*) printf '%s' "${env_line#TMUX_EDIT_TARGET=}" ;; + esac +} + +# Resolve the target pane id, falling back to the last pane. +resolve_target_pane() { + local candidate="$1" + local current_pane last_pane + + current_pane="$(tmux display-message -p "#{pane_id}" 2>/dev/null || true)" + log "current pane=${current_pane:-<empty>}" + if [ -n "$candidate" ] && [[ "$candidate" == *"#{"* ]]; then + log "format target detected, clearing" + candidate="" + fi + if [ -z "$candidate" ]; then + candidate="$(tmux display-message -p "#{last_pane}" 2>/dev/null || true)" + elif [ "$candidate" = "$current_pane" ]; then + last_pane="$(tmux display-message -p "#{last_pane}" 2>/dev/null || true)" + if [ -n "$last_pane" ]; then + candidate="$last_pane" + fi + fi + printf '%s' "$candidate" +} + +# Capture the latest multi-line prompt content from the pane. +capture_prompt_text() { + local target="$1" + tmux capture-pane -p -t "$target" -S -2000 2>/dev/null | awk ' + function trim_box(line) { + sub(/^ *│ ?/, "", line) + sub(/ *│ *$/, "", line) + sub(/[[:space:]]+$/, "", line) + return line + } + /^ *│ *→/ && index($0,"INSERT")==0 && index($0,"Add a follow-up")==0 { + if (text != "") last = text + text = "" + capture = 1 + line = $0 + sub(/^.*→ ?/, "", line) + line = trim_box(line) + if (line != "") text = line + next + } + capture { + if ($0 ~ /^ *└/) { + capture = 0 + if (text != "") last = text + next + } + if ($0 ~ /^ *│/ && index($0,"INSERT")==0 && index($0,"Add a follow-up")==0) { + line = trim_box($0) + if (line != "") { + if (text != "") text = text " " line + else text = line + } + } + } + END { + if (text != "") last = text + if (last != "") print last + } + ' +} + +# Write captured prompt text into the temp file if available. +prefill_tmpfile() { + local tmpfile="$1" + local prompt_text="$2" + if [ -n "$prompt_text" ]; then + printf '%s\n' "$prompt_text" > "$tmpfile" + fi +} + +# Ensure the target pane exists before sending keys. +validate_target_pane() { + local target="$1" + local pane target_found + if [ -z "$target" ]; then + log "error: no target pane determined" + echo "Could not determine target pane." >&2 + return 1 + fi + target_found=0 + for pane in $(tmux list-panes -a -F "#{pane_id}" 2>/dev/null || true); do + if [ "$pane" = "$target" ]; then + target_found=1 + break + fi + done + if [ "$target_found" -ne 1 ]; then + log "error: target pane not found: $target" + echo "Target pane not found: $target" >&2 + return 1 + fi +} + +# Send temp file contents to the target pane line by line. +send_content() { + local target="$1" + local tmpfile="$2" + local prompt_text="$3" + local first_line=1 + local line + while IFS= read -r line || [ -n "$line" ]; do + if [ "$first_line" -eq 1 ] && [ -n "$prompt_text" ]; then + if [[ "$line" == "$prompt_text"* ]]; then + line="${line#"$prompt_text"}" + fi + fi + first_line=0 + tmux send-keys -t "$target" -l "$line" + tmux send-keys -t "$target" Enter + done < "$tmpfile" + log "sent content to $target" +} + +# Main entry point. +main() { + local target_file="${1:-}" + local target + local editor="${EDITOR:-vi}" + local tmpfile + local prompt_text + + target="$(read_target_from_file "$target_file" || true)" + if [ -n "$target" ]; then + log "file target=${target:-<empty>}" + rm -f "$target_file" + fi + if [ -z "$target" ]; then + target="${TMUX_EDIT_TARGET:-}" + fi + log "env target=${target:-<empty>}" + if [ -z "$target" ]; then + target="$(read_target_from_env || true)" + fi + log "tmux env target=${target:-<empty>}" + target="$(resolve_target_pane "$target")" + log "fallback target=${target:-<empty>}" + + tmpfile="$(mktemp "./.tmux-edit-send.XXXXXX.md")" + trap 'rm -f "$tmpfile"' EXIT + + prompt_text="$(capture_prompt_text "$target")" + prefill_tmpfile "$tmpfile" "$prompt_text" + + "$editor" "$tmpfile" + log "editor exited with status $?" + + if [ ! -s "$tmpfile" ]; then + log "empty file, nothing sent" + exit 0 + fi + + validate_target_pane "$target" + send_content "$target" "$tmpfile" "$prompt_text" +} + +main "$@" +``` + +## Challenges and small discoveries + +The problems were mostly small but annoying: + +* Getting the right target pane was the first hurdle. I ended up storing the pane id in a file because of tmux format expansion quirks. +* The Cursor UI draws a nice box around the prompt, so the prompt line contains a `│` and other markers. I had to filter those out and strip the box-drawing characters. +* When I prefilled text and then sent it back, I sometimes duplicated the prompt. Stripping the prefilled prompt text from the first line fixed that. + +## Test cases (for a future rewrite) + +These are the cases I test whenever I touch the script: + +* Single-line prompt: capture everything after `→` and prefill the editor. +* Multi-line boxed prompt: capture the wrapped lines inside the `│ ... │` box and join them with spaces (no newline in the editor). +* Ignore UI noise: do not capture lines containing `INSERT` or `Add a follow-up`. +* Preserve appended text: if I add ` juju` to an existing line, the space before `juju` must survive. +* No duplicate send: if the prefilled text is still at the start of the first line, it must be stripped once before sending back. + +## (Almost) works with any editor (or any TUI) + +Although I use Helix, this is just `$EDITOR`. If you prefer Vim, Neovim, or something more exotic, it should work. The same mechanism can be used to feed text into any TUI that reads from a terminal pane, not just Cursor Agent. + +One caveat: different agents draw different prompt UIs, so the capture logic depends on the prompt shape. A future version of this script should be more modular in that respect; for now this is just a PoC tailored to Cursor Agent. + +If I get a chance, I'll clean it up and rewrite it in Go (and release it properly). For now, I am happy with this little hack. It already feels like a native editing workflow for Cursor Agent prompts. + +E-Mail your comments to `paul@nospam.buetow.org` :-) + +Other related posts are: + +[2026-02-02 A tmux popup editor for Cursor Agent prompts (You are currently reading this)](./2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md) +[2025-08-05 Local LLM for Coding with Ollama on macOS](./2025-08-05-local-coding-llm-with-ollama.md) +[2025-05-02 Terminal multiplexing with `tmux` - Fish edition](./2025-05-02-terminal-multiplexing-with-tmux-fish-edition.md) +[2024-06-23 Terminal multiplexing with `tmux` - Z-Shell edition](./2024-06-23-terminal-multiplexing-with-tmux.md) + +[Back to the main site](../) diff --git a/gemfeed/index.md b/gemfeed/index.md index b7feed45..3e0bd151 100644 --- a/gemfeed/index.md +++ b/gemfeed/index.md @@ -2,6 +2,7 @@ ## To be in the .zone! +[2026-02-02 - A tmux popup editor for Cursor Agent prompts](./2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md) [2026-01-01 - Using Supernote Nomad offline](./2026-01-01-using-supernote-nomad-offline.md) [2026-01-01 - Posts from July to December 2025](./2026-01-01-posts-from-july-to-december-2025.md) [2026-01-01 - Cloudless Kobo Forma with KOReader](./2026-01-01-cloudless-kobo-forma-with-koreader.md) diff --git a/gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo1.png b/gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo1.png Binary files differnew file mode 100644 index 00000000..5985d55f --- /dev/null +++ b/gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo1.png diff --git a/gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo2.png b/gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo2.png Binary files differnew file mode 100644 index 00000000..1d7f26d7 --- /dev/null +++ b/gemfeed/tmux-popup-editor-for-cursor-agent-prompts/demo2.png @@ -1,6 +1,6 @@ # Hello! -> This site was generated at 2026-01-31T19:49:46+02:00 by `Gemtexter` +> This site was generated at 2026-02-01T20:24:16+02:00 by `Gemtexter` Welcome to the foo.zone! @@ -30,6 +30,7 @@ Everything you read on this site is my personal opinion and experience. You can ### Posts +[2026-02-02 - A tmux popup editor for Cursor Agent prompts](./gemfeed/2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.md) [2026-01-01 - Using Supernote Nomad offline](./gemfeed/2026-01-01-using-supernote-nomad-offline.md) [2026-01-01 - Posts from July to December 2025](./gemfeed/2026-01-01-posts-from-july-to-december-2025.md) [2026-01-01 - Cloudless Kobo Forma with KOReader](./gemfeed/2026-01-01-cloudless-kobo-forma-with-koreader.md) diff --git a/uptime-stats.md b/uptime-stats.md index a70fc7cf..e01d131d 100644 --- a/uptime-stats.md +++ b/uptime-stats.md @@ -1,6 +1,6 @@ # My machine uptime stats -> This site was last updated at 2026-01-31T19:49:46+02:00 +> This site was last updated at 2026-02-01T20:24:16+02:00 The following stats were collected via `uptimed` on all of my personal computers over many years and the output was generated by `guprecords`, the global uptime records stats analyser of mine. |
