From c5cd80b4bed1234152f19d23ddac51d86ba36f0f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 8 Feb 2026 17:38:07 +0200 Subject: Fix Claude agent clearing to use readline instead of vim commands Claude Code's prompt input field does not support vim commands for clearing. The previous sequence 'Escape gg C-v G d i' resulted in literal text 'gGdijo' appearing in the prompt instead of clearing it. Changed to 'C-a C-k' (Emacs/readline style): - C-a: Move cursor to start of line - C-k: Kill (delete) from cursor to end of line Also added 150ms delay after Escape key in sendClearSequence to ensure mode transitions complete before subsequent keys are sent (though Claude uses readline, this helps other potential vim-based agents). Changes: - internal/tmuxedit/claude_agent.go: clearKeys "C-a C-k" instead of vim - internal/tmuxedit/claude_agent_test.go: Update test expectations - internal/tmuxedit/agentutil.go: Add time import and Escape delay - docs/usage.md: Update claude clear method documentation - docs/tmux.md: Clarify claude uses readline not vim - config.toml.example: Update claude description Integration tested: - Extracted: "final verification test" - Sent: "FINAL REPLACED TEXT NO VIM COMMANDS" - Result: Clean replacement with NO vim command artifacts - All unit tests pass (67/67) - Coverage: 80.9% Co-authored-by: Cursor --- docs/tmux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/tmux.md') diff --git a/docs/tmux.md b/docs/tmux.md index 1ece4c7..e7c99dd 100644 --- a/docs/tmux.md +++ b/docs/tmux.md @@ -92,9 +92,9 @@ Then press `prefix + e` in any pane running an AI agent. Hexai auto-detects the See the [configuration guide](configuration.md) for customizing popup dimensions and agent patterns, or the [usage guide](usage.md) for the full workflow description. **Input mode notes**: Each agent uses different clearing methods based on their input handling: -- **Claude Code**: Uses Vi/Vim keybindings (`Escape gg C-v G d i`), so vim mode is recommended -- **Cursor**: Uses simple backspace clearing (`End BSpace*200`), works in default mode -- **Amp**: Uses Emacs/readline keybindings (`C-u`), works in TUI mode +- **Claude Code**: Uses Emacs/readline keybindings (`C-a C-k`) +- **Cursor**: Uses simple backspace clearing (`End BSpace*200`) +- **Amp**: Uses Emacs/readline keybindings (`C-u`) - **Aider**: Uses Emacs/readline keybindings (`C-u`) The popup editor uses `$EDITOR` (or `$HEXAI_EDITOR`), so your normal vim/neovim setup is used for composing prompts. -- cgit v1.2.3