Different bash prompt for different vi editing mode?

后端 未结 9 965
深忆病人
深忆病人 2020-12-22 16:45

When using vi mode (set -o vi) with Bash, it would be nice to have a prompt that depends on the mode you are currently in (insert or command). How does one find out this edi

9条回答
  •  無奈伤痛
    2020-12-22 17:24

    Fresh bash 4.3 and readline 6.3 have something for you guys.. from the changelog:

    4.  New Features in Readline
    j.  New user-settable variable, show-mode-in-prompt, adds a characters to the
        beginning of the prompt indicating the current editing mode.
    

    So putting

    set show-mode-in-prompt on
    

    into /etc/inputrc or ~/.inputrc (thx stooj) should affect all your readline-enabled programs ;)

提交回复
热议问题