Skip to content

Vi Mode: Allow setting "Cursor" and "Prompt" ViModeIndicator at the same time #5006

@sebastiancarlos

Description

@sebastiancarlos

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

Currently you can do both:

Set-PSReadLineOption -ViModeIndicator Cursor

and,

Set-PSReadLineOption -ViModeIndicator Prompt

But you can't set both at the same time.

Note that this is possible with readline, for example with:

set editing-mode vi

# vi INSERT prompt
# - "\e[6 q" is line caret
# - "\e[30;44m" is black on blue
# - "\e[0m" is reset
# = "\1" and "\2" are used to escape the non-printing characters
set vi-ins-mode-string "\1\e[6 q\e[30;44m\2 INS \1\e[0m\2 "

# vi NORMAL prompt
# - "\e[2 q" is block caret
# - "\e[30;47m" is black on white
# - "\e[0m" is reset
# = "\1" and "\2" are used to escape the non-printing characters
set vi-cmd-mode-string "\1\e[2 q\e[30;47m\2 NOR \1\e[0m\2 "

I understand that you can run a script block on -ViModeChangeHandler, but it's not trivial how to programatically change the already rendered prompt when this fires.

Proposed technical implementation details (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementIt's a feature request.Needs-Triage 🔍It's a new issue that core contributor team needs to triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions