summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-10 09:17:40 +0200
committerPaul Buetow <paul@buetow.org>2026-02-10 09:17:40 +0200
commit1b62f0bddc639a9b30ff95ea2326e52f9b1e7528 (patch)
tree64586d4415dab2a267d6c0667e2283a07665b79f
parent8b04018b1836730c9efe96fabd67ffd48c00865d (diff)
Fix hexai-tmux-edit to open in current working directory
hexai-tmux-edit was opening in the wrong directory because the tmux popup wasn't being told which directory to use. This fix: - Updates bind-key example to cd into pane's current path - Passes working directory to popup via -d flag using os.Getwd() - Updates all documentation with corrected bind-key examples Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
-rw-r--r--cmd/hexai-tmux-edit/main.go2
-rw-r--r--config.toml.example2
-rw-r--r--docs/configuration.md2
-rw-r--r--docs/tmux.md2
-rw-r--r--docs/usage.md2
-rw-r--r--internal/tmuxedit/run.go11
-rw-r--r--internal/version.go2
7 files changed, 15 insertions, 8 deletions
diff --git a/cmd/hexai-tmux-edit/main.go b/cmd/hexai-tmux-edit/main.go
index 928a2cd..931d1c4 100644
--- a/cmd/hexai-tmux-edit/main.go
+++ b/cmd/hexai-tmux-edit/main.go
@@ -8,7 +8,7 @@
//
// Tmux keybinding (add to ~/.tmux.conf):
//
-// bind e run-shell -b "hexai-tmux-edit --pane '#{pane_id}'"
+// bind e run-shell -b "cd '#{pane_current_path}' && hexai-tmux-edit --pane '#{pane_id}'"
package main
import (
diff --git a/config.toml.example b/config.toml.example
index f2bd66f..d23f738 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -166,7 +166,7 @@ temperature = 0.2
# - amp: Box UI │...│ (TUI mode), clears with C-u (Emacs/readline)
# - aider: Shell-style > prompt, clears with C-u (Emacs/readline)
# Tmux keybinding (add to ~/.tmux.conf):
-# bind e run-shell -b "hexai-tmux-edit --pane '#{pane_id}'"
+# bind e run-shell -b "cd '#{pane_current_path}' && hexai-tmux-edit --pane '#{pane_id}'"
# [[tmux_edit.agents]]
# name = "claude"
diff --git a/docs/configuration.md b/docs/configuration.md
index 52e0689..939b001 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -141,4 +141,4 @@ Hexai Tmux Edit (popup editor)
```
- Built-in agents: `claude`, `cursor`, `amp`, `aider`. See [config.toml.example](../config.toml.example) for all fields.
-- Tmux keybinding: `bind e run-shell -b "hexai-tmux-edit --pane '#{pane_id}'"`
+- Tmux keybinding: `bind e run-shell -b "cd '#{pane_current_path}' && hexai-tmux-edit --pane '#{pane_id}'"`
diff --git a/docs/tmux.md b/docs/tmux.md
index e7c99dd..b851296 100644
--- a/docs/tmux.md
+++ b/docs/tmux.md
@@ -84,7 +84,7 @@ The editor opens as a tmux popup overlay, pre-filled with any existing prompt te
Add this keybinding to `~/.tmux.conf`:
```
-bind e run-shell -b "hexai-tmux-edit --pane '#{pane_id}'"
+bind e run-shell -b "cd '#{pane_current_path}' && hexai-tmux-edit --pane '#{pane_id}'"
```
Then press `prefix + e` in any pane running an AI agent. Hexai auto-detects the agent, extracts any existing prompt text, and pre-fills the editor. After saving and closing, the edited text is sent back to the agent's pane.
diff --git a/docs/usage.md b/docs/usage.md
index 387ad34..4d1b50b 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -183,7 +183,7 @@ Additional agents can be added via `[tmux_edit.agents]` in config.toml without c
Add to `~/.tmux.conf`:
```
-bind e run-shell -b "hexai-tmux-edit --pane '#{pane_id}'"
+bind e run-shell -b "cd '#{pane_current_path}' && hexai-tmux-edit --pane '#{pane_id}'"
```
The `#{pane_id}` is expanded by tmux to the active pane at keypress time, so the popup editor always knows which pane to send text back to.
diff --git a/internal/tmuxedit/run.go b/internal/tmuxedit/run.go
index f81eb64..8c98ded 100644
--- a/internal/tmuxedit/run.go
+++ b/internal/tmuxedit/run.go
@@ -58,10 +58,17 @@ var openEditorPopup = func(initial, popupW, popupH string) (string, error) {
}
// launchPopup is the seam for running `tmux display-popup` with the editor.
-// The -E flag makes the popup close when the editor exits. Uses .Run()
-// (not .Output()) so the popup blocks until the user closes the editor.
+// The -E flag makes the popup close when the editor exits. The -d flag sets
+// the working directory for the popup. Uses .Run() (not .Output()) so the
+// popup blocks until the user closes the editor.
var launchPopup = func(ed, path, width, height string) error {
args := []string{"display-popup", "-E"}
+
+ // Get current working directory to pass to the popup
+ if cwd, err := os.Getwd(); err == nil && cwd != "" {
+ args = append(args, "-d", cwd)
+ }
+
if width != "" {
args = append(args, "-w", width)
}
diff --git a/internal/version.go b/internal/version.go
index 50b476f..027fd1f 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -1,4 +1,4 @@
// Summary: Hexai semantic version identifier used by CLI and LSP binaries.
package internal
-const Version = "0.18.2"
+const Version = "0.18.3"