Open trbjo opened 11 months ago
zsh does not redraw my prompt when I jump with fzf
Please clarify. When using fzf integration in z.lua
, should it be clean prompt after jumping to the directory.
我也有这个问题,通过fzf, 选择一个路径后,prompt没有刷新,实际目录已经跳转过去了。
我也有这个问题, 通过 fzf, 选择一个路径后,prompt 没有刷新,实际目录已经跳转过去了
I also have this problem. Through fzf, after selecting a path, the prompt is not refreshed and the actual directory has been redirected.
实际上这并不是一个问题,就是这么设计的,或者我没有找到 prompt 刷新的方法(我花了三天的空余时间来查看文档并实现这个功能,如果你有更好的方式欢迎提交 PR 去修改它)。
In fact, this is not a problem, it's designed this way, or I haven't found the method to refresh the prompt (I spent three days of my spare time reviewing the documentation and implementing this feature, if you have a better way feel free to submit a PR to modify it).
如果 fzf 跳转让你感到困惑,在初始化时删除 fzf 即可,它会回到之前的功能。
If fzf complete makes you feel confused, you can delete fzf during init, and it will return to its previous function.
- eval "$($ZLUA_EXEC $ZLUA_SCRIPT --init zsh once enhanced fzf)"
+ eval "$($ZLUA_EXEC $ZLUA_SCRIPT --init zsh once enhanced)"
I'm running into the same issue where my prompt does not get updated/refreshed after selecting a destination with fzf. This is how I've installed z.lua:
export _ZL_ADD_ONCE=1
export _ZL_DATA="$XDG_DATA_HOME/z.lua/database"
export _ZL_ECHO=1
export _ZL_HYPHEN=1
export _ZL_MATCH_MODE=1
export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json"
zinit wait lucid light-mode for \
has'lua' \
atclone'mkdir -p "$(dirname "$_ZL_DATA")"; touch "$_ZL_DATA"' \
id-as'auto' \
@skywind3000/z.lua
Here's what I see. I select the ~/Downloads
directory but my prompt does not update until I hit Enter again.
Hi @rrpolanco
What prompt framework do you use? (I use starship^1, have not encountered such a problem)
Hi @kang8, I'm using powerlevel10k to render my prompt. Maybe there is some setting I need to set in p10k to redraw the prompt.
Does z.lua invoke precmd hooks before resetting prompt? If not, this explains why it doesn't work with powerlevel10k. You can invoke the hooks like this:
local f
for f in precmd ${precmd_functions[@]}; do
[[ "${+functions[$f]}" == 0 ]] || "$f" &>/dev/null || true
done
z.lua should be initialized before powerlevel10k, but the zsh code is written by other contributor and I don't know how to improve it:
https://github.com/skywind3000/z.lua/blob/7f2bfcbfc1e5f7572dd436a5a9b9e42b56a8efd0/z.lua#L2233-L2251
@romkatv , does the index of precmd_functions array relate to the precmd execution order ? If so, how to modify the zsh initializing code to put z.lua to the first one ?
zsh does not redraw my prompt when I jump with fzf. Does anyone else have the same problem?
Look how fzf ensures the prompt is redrawn after https://github.com/junegunn/fzf/blob/3c09c77269d848f5e7dd8f350a90e8d7ed760845/shell/key-bindings.zsh#L88