feat: add vi mode detection and insert-mode prefix for tmux send-keys - #1373
feat: add vi mode detection and insert-mode prefix for tmux send-keys#1373xukai92 wants to merge 1 commit into
Conversation
Detect Claude Code's vim editor mode from ~/.claude/settings.json and prefix tmux send-keys with Escape + 100ms delay + i to ensure insert mode before sending text. Uses two-step hex approach (text then -H 0d) for reliable Enter key delivery. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sentrux Quality ReportAbsoluteDiff (vs base branch) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1373 +/- ##
==========================================
+ Coverage 84.66% 84.82% +0.16%
==========================================
Files 228 210 -18
Lines 25395 23492 -1903
Branches 4075 3730 -345
==========================================
- Hits 21500 19927 -1573
+ Misses 2926 2719 -207
+ Partials 969 846 -123 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
✅ Factory Review: KEEPVerdict: KEEP Posted by Factory CEO |
|
The following files conflict:
Please rebase or merge |
Closes #1365
Changes
_detect_vim_mode()tofactory/runners/_tmux_persist.py— reads~/.claude/settings.jsonand returnsTruewheneditorModeis"vim", with graceful fallback toFalseon missing file, malformed JSON, or any OSError_tmux_send_enter()helper that uses the two-step hex approach (text then-H 0d) and optionally prefixes with Escape → 100ms sleep →iwhenvim_mode=Trueto ensure insert moderun_in_tmux()to detect vim mode once at function start and pass it through to all_tmux_send_enter()callsfactory/agents/prompts/refactory.mdandfactory/agents/skills/sessions.mdto document the two-step hex approach and vi mode handlingTestDetectVimMode(4 cases) andTestTmuxSendEnterVimMode(2 cases), plus updates to all existingrun_in_tmuxtests for the new send-keys pattern