gpt4 book ai didi

linux - zsh + 电力线 : prompt disappears with long command line

转载 作者:太空宇宙 更新时间:2023-11-04 10:39:20 25 4
gpt4 key购买 nike

asciicast

如你所见,当我写一个很长的命令行时,zsh提示符消失了,我也不知道为什么


.zshrc :

autoload -U compinit promptinit
compinit
promptinit

zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BDésolé, pas de résultats pour : %d%b'
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s


function powerline_precmd() {
PS1="$(~/powerline-shell.py $? --shell zsh 2> /dev/null)"
}

function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}

if [ "$TERM" != "linux" ]; then
install_powerline_precmd
fi

bindkey ';5D' emacs-backward-word
bindkey ';5C' emacs-forward-word

我使用 Xfce4-terminal,我在 Debian stretch 上

谢谢

最佳答案

这是由于 zsh 如何决定提示的长度。通常使用标准命令它自己可以正常工作,但是,运行 python 脚本并将其回显到提示符会混淆它,我无法正确修复它,添加 %27{ 之前和 %} 之后 $(~/powerline-shell.py $? --shell zsh 2>/dev/null) 使它看起来适用于我,但这只是根据我的电力线提示临时解决的问题。

一个更可行的解决方法是转储 powerline-shell 并乱用 bash-powerline完全使用 bash 命令编写,与 zsh 交叉兼容。

关于linux - zsh + 电力线 : prompt disappears with long command line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35881930/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com