Different bash prompt for different vi editing mode?

后端 未结 9 957
深忆病人
深忆病人 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:23

    for Multiline prompt like this image

    my work arround is like this

    my bash prompt

    export PS1=" ┌錄 \[\e[32m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\] \w \\$ \n "
    

    .inputrc

    set show-mode-in-prompt on
    set vi-ins-mode-string " └──錄 (ins):"
    set vi-cmd-mode-string " └──錄 (cmd):"
    

    hope this helped you

提交回复
热议问题