zsh的vi模式状态行 [英] zsh vi mode status line

查看:272
本文介绍了zsh的vi模式状态行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有在的zsh或bash办法有一个状态行?例如第六它会让你知道,你在插入模式
- 插入 -

Is there a way in zsh or bash to have a status line? e.g. in VI it will let you know that you are in insert mode with -- INSERT --

是否有命令行的eqivalent?

Is there an eqivalent for the command line?

推荐答案

这已经在的超级用户 Unix的堆叠交换的。堆栈溢出的完整性:

This has already been answered at Super User and Unix Stack Exchange. For the completeness of Stack Overflow:

function zle-line-init zle-keymap-select {
    RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
    RPS2=$RPS1
    zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select

如果你想在当前线以下,而不是正确的指示,从<一个href=\"http://unix.stackexchange.com/questions/1022/is-it-possible-to-display-stuff-below-the-prompt-at-a-prompt\">Unix堆叠交换:

terminfo_down_sc=$terminfo[cud1]$terminfo[cuu1]$terminfo[sc]$terminfo[cud1]
function zle-line-init zle-keymap-select {
    PS1_2="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
    PS1="%{$terminfo_down_sc$PS1_2$terminfo[rc]%}%~ %# "
    zle reset-prompt
}
preexec () { print -rn -- $terminfo[el]; }

这篇关于zsh的vi模式状态行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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