针对不同的Vi编辑模式的不同bash提示符? [英] Different bash prompt for different vi editing mode?

查看:138
本文介绍了针对不同的Vi编辑模式的不同bash提示符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用vi模式(设置-o六)使用bash,这将是不错的,它取决于你目前在(插入或命令)模式的提示。怎样才能找到这个编辑模式?

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 editing mode?

顺便说一句,这似乎是在 ZSH <可能/ A>

B.t.w, this seems to be possible in ZSH:

推荐答案

新鲜的bash 4.3和readline 6.3具有changelog的东西给你们..:

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.

所以把

set show-mode-in-prompt on

到/ etc / INPUTRC或〜/ .inputrc文件(THX stooj)应该影响你所有的readline启用的程序;)

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

这篇关于针对不同的Vi编辑模式的不同bash提示符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆