GithubHelp home page GithubHelp logo

Comments (9)

kang8 avatar kang8 commented on June 26, 2024

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.

from z.lua.

Marskey avatar Marskey commented on June 26, 2024

我也有这个问题,通过fzf, 选择一个路径后,prompt没有刷新,实际目录已经跳转过去了。

from z.lua.

kang8 avatar kang8 commented on June 26, 2024

我也有这个问题, 通过 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)"

from z.lua.

rrpolanco avatar rrpolanco commented on June 26, 2024

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.

zlua_issue_186

from z.lua.

kang8 avatar kang8 commented on June 26, 2024

Hi @rrpolanco

What prompt framework do you use? (I use starship1, have not encountered such a problem)

2023-09-20 09 19 45

Footnotes

  1. https://starship.rs/

from z.lua.

rrpolanco avatar rrpolanco commented on June 26, 2024

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.

from z.lua.

romkatv avatar romkatv commented on June 26, 2024

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

from z.lua.

skywind3000 avatar skywind3000 commented on June 26, 2024

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:

z.lua/z.lua

Lines 2233 to 2251 in 7f2bfcb

local script_init_zsh = [[
_zlua_precmd() {
(_zlua --add "${PWD:a}" &)
}
typeset -ga precmd_functions
[ -n "${precmd_functions[(r)_zlua_precmd]}" ] || {
precmd_functions[$(($#precmd_functions+1))]=_zlua_precmd
}
]]
local script_init_zsh_once = [[
_zlua_precmd() {
(_zlua --add "${PWD:a}" &)
}
typeset -ga chpwd_functions
[ -n "${chpwd_functions[(r)_zlua_precmd]}" ] || {
chpwd_functions[$(($#chpwd_functions+1))]=_zlua_precmd
}
]]

@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 ?

from z.lua.

hmgle avatar hmgle commented on June 26, 2024

I also encountered this issue. However, after adding the fzf-tab plugin wrapper for zsh, the problem disappeared even when zlua was initialized with the fzf option.

Perhaps using fzf through fzf-tab is a better choice.

from z.lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.