Skip to content

Vi mode prompt feature requests #616

@excited-bore

Description

@excited-bore
  1. Is there a way to show the current mode before the prompt?

In regular bash, there's a way to show both vi-insert/vi-command modes in the prompt before PS1

bind 'set show-mode-in-prompt on'
bind 'set vi-ins-mode-string  (ins)\1\e[5 q\2\1\e[3m\2'
bind 'set vi-cmd-mode-string (cmd)\1\e[2 q\2\1\e[3m\2'

this essentially makes the default prompt (when starting in bash's vi-insert) from:

[user@user-machine /home/user]$

to

(ins)[user@user-machine /home/user]$

which i prefer over the way ble.sh seems to do it, which is show the state of the line editor after prompt and the current line. It comes over as a bit chaotic, and i'd love to have an option that updates bind 'set vi-cmd-mode-string` every time the mode for ble changes (since it seems to register all modes except insert mode as command),
so something like

(visual)[user@user-machine /home/user]$

would be possible.

  1. Also regarding vi mode prompts; there doesn't seem to be complete control over the customizaibility of the modeprompts. Right now you can fully change -- NORMAL -- to (cmd) or something else using bleopt keymap_vi_mode_string_nmap, but you can't do the same for bleopt keymap_vi_mode_string_imap or other modes (because these options don't exist, only for nmap).
    You can set bleopt keymap_vi_mode_name_insert='(ins)', but if done the prompt goes from
[user@user-machine /home/user]$
*-- INSERT --*

to

[user@user-machine /home/user]$
*-- (ins) --*

while I don't really like the --'s and I might not want it to be printed out in bold.

So I see out of 2 approaches to this:

  • Either add bleopt keymap_vi_mode_string_imap, bleopt keymap_vi_mode_string_xmap, bleopt keymap_vi_mode_string_omap, etc.. because right now only bleopt keymap_vi_mode_string_nmap is an option
  • Or, another way would be to add the option bleopt keymap_vi_mode_name_normal (since right now this option doesn't exist) and make the text set by these options reflect more accurately by what is being shown when printed out.

Like if I were to set bleopt keymap_vi_mode_name_insert='(ins)' then it wouldn't print the added --'s.
Then if the user wanted to change the style from bold to something different, it might be more appropriate to add something like keymap_vi_mode_name_*mode*_style as typeface options for each specific mode (which at default are set to bold) because typing the typeface is cleaner then using escape codes (and one for each specific mode to maximize customizability to the user).
TL;DR I'd be really awesome if changing the keymap_vi_mode_name_*mode* removed the --'s that are printed out right now, as well as the ability to set styles using something like this:

bleopt keymap_vi_mode_name_ insert_style='bold'
bleopt keymap_vi_mode_name_replace_style='bold'
bleopt keymap_vi_mode_name_vreplace_style='italicbold'
bleopt keymap_vi_mode_name_visual_style='italic'
bleopt keymap_vi_mode_name_select_style=
bleopt keymap_vi_mode_name_linewise_style=
bleopt keymap_vi_mode_name_blockwise_style=

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateDuplicate / Already fixed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions