feat: add vi mode detection and insert-mode prefix for tmux send-keys - #1373
Open
xukai92 wants to merge 1 commit into
Open
feat: add vi mode detection and insert-mode prefix for tmux send-keys#1373xukai92 wants to merge 1 commit into
xukai92 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:
|
Collaborator
Author
✅ Factory Review: KEEPVerdict: KEEP Posted by Factory CEO |
xukai92
marked this pull request as ready for review
August 21, 2026 04:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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