我在 VI 模式下运行 zsh,并显示两行提示符。每当我使用“cc”清除该行时,提示符上方的一行就会被删除。例如,如果我从
magnus@tatooine 2502 ~
[I] %
magnus@tatooine 2502 ~
[I] %
Run Code Online (Sandbox Code Playgroud)
然后我按转义键并“抄送”我得到
magnus@tatooine 2502 ~
magnus@tatooine 2502 ~
[I] %
Run Code Online (Sandbox Code Playgroud)
其重复性非常强;我可以通过多次重复该序列来清除终端。我需要做什么才能让 ZSH 清除该行而不删除其上方的行?
我的提示是使用以下命令创建的
zstyle ':vcs_info:*' enable git hg svn
zstyle ':vcs_info:(git*|hg*)' get-revision true
zstyle ':vcs_info:(git*|hg*)' check-for-changes true
zstyle ':vcs_info:git*' formats "(%s: %12.12i %c%u %b)" # hash changes branch
zstyle ':vcs_info:git*' actionformats "(%s(%F{yellow}%a%f): %12.12i %c%u %b)"
zstyle ':vcs_info:hg*:*' branchformat "%b" # only show branch
zstyle ':vcs_info:(hg*|git*):*' stagedstr "%F{green}S%f"
zstyle ':vcs_info:(hg*|git*):*' unstagedstr "%F{red}U%f"
zstyle ':vcs_info:git*+set-message:*' hooks git-st git-stash git-untracked
# improve the ZSH prompt in vi mode
function zle-line-init zle-keymap-select {
case ${KEYMAP} in
(main) prompt_vi_mode="%F{yellow}[I]%f"
;;
(vicmd) prompt_vi_mode="%F{red}[N]%f"
;;
esac
prompt_line1="%F{green}%n@%m%f %F{red}%h%f ${vcs_info_msg_0_} %F{blue}%~%f"
prompt_line2="${prompt_vi_mode} %B%#%b "
PS1="${prompt_line1}${prompt_newline}${prompt_line2}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
417 次 |
| 最近记录: |