feat: add vi mode indicator support for prompts#23
Merged
Conversation
Add configuration and runtime support for vi mode indicators in prompts:
- Add ViConfig/ViSymbol structs for vi mode symbol configuration
- insert: symbol for vi insert mode
- normal: symbol for vi normal mode
- non_vi: symbol for non-vi modes (Emacs, future Helix, etc.)
- Add ViColorConfig for vi mode indicator colors
- Add {vi} placeholder to PromptFormatter for dynamic vi mode expansion
- Update RPrompt to render vi mode indicators with colors via
render_prompt_indicator()
- Update PromptRuntimeConfig to pass ViConfig and ViColorConfig
Design notes:
- ViSymbol is pub(crate) as it's an internal implementation detail
- non_vi field added for future-proofing (potential Helix mode support)
- Status colors and vi colors apply to different parts of the prompt
and don't conflict
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Rename `vi_color` field to `vi_colors` in PromptRuntimeConfig and RPrompt - Rename `with_vi_color()` method to `with_vi_colors()` in RPrompt - Remove unused re-exports from editor/mod.rs - Add #[allow(dead_code)] to ViMode and format_with_vi (reserved for future use) This aligns with the existing `status_colors` naming convention. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add documentation for the vi mode indicator feature:
- Add {vi} placeholder to prompt placeholders table
- Add [prompt.vi] and [colors.prompt.vi] to default config
- Add vi mode colors to prompt colors table
- Add new "Vi Mode Indicator" section with configuration examples
Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/arf-console/src/config/snapshots/arf__config__tests__schema_tests__config_schema.snap
Outdated
Show resolved
Hide resolved
Resolved conflicts in: - config/mod.rs: merged ViConfig export - config/prompt.rs: added ViSymbol and ViConfig, removed duplicate StatusConfig impl - repl/state.rs: merged vi config handling in prompts and tests Co-Authored-By: Claude Opus 4.5 <[email protected]>
The {vi} placeholder now works as documented:
- When {vi} is in the prompt format string, it expands to the current
vi mode symbol (insert/normal/non_vi) at that position
- render_prompt_indicator returns empty when {vi} is present to avoid
duplicate display
- Uses Cell<EditModeKind> to track mode with interior mutability
This allows users to position the vi mode indicator anywhere in their
prompt format string, e.g., "R [{vi}] {version}> ".
Includes comprehensive tests for the placeholder functionality.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds test_pty_vi_placeholder_mode_switch to document the current
behavior of the {vi} placeholder.
Documents known issue: The {vi} placeholder is always 1 render cycle
behind the actual vi mode due to reedline's Prompt trait design:
- render_prompt_left() is called before render_prompt_indicator()
- Mode information is only passed to render_prompt_indicator()
Observed behavior:
- After Escape: [I] (should be [N]) - 1 cycle behind
- After 'j': [N] (correct, but delayed)
- After 'i': [N] (should be [I]) - 1 cycle behind
Co-Authored-By: Claude Opus 4.5 <[email protected]>
This reverts commit fe7e2e5.
Remove {vi} placeholder approach due to 1-cycle delay issue caused by
reedline's render order (render_prompt_left called before render_prompt_indicator).
Instead, display vi mode indicator at end of prompt via render_prompt_indicator(),
following the same approach as nushell.
- Remove ViMode enum and format_with_vi from editor/prompt.rs
- Add documentation comments explaining reedline constraint
- Update docs with recommended config using ">" and ":" indicators
- Update integration test to verify correct mode switching
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eitsupi
added a commit
that referenced
this pull request
Feb 1, 2026
- [Unreleased] history import (#31), :info enhancements (#29) - [0.2.0-beta.1] vi mode indicator (#23), Windows Rprofile fix (#20) Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Fix #22