skywind3000 / z.lua

:zap: A new cd command that helps you navigate faster by learning your habits.
MIT License
2.94k stars 137 forks source link

Looking for ~/.local/bin/lua #180

Closed xuan-w closed 1 year ago

xuan-w commented 1 year ago

Problem:

Add z.lua to bashrc using eval "$(lua ~/path2z.lua/z.lua --init bash once enhanced)" . Bash started normally, z command is available. However, when I try to call z command, I got this error:

-bash: /home/username/.local/bin/lua: No such file or directory

Expected behavior:

No error.

System Information: WSL on Windows 10, Ubuntu 22.04 lua 5.4, installed to /usr/bin/lua.

After I ln -s /usr/bin/lua /home/username/.local/bin/lua, I can use z command. But this shouldn't be the right way to solve this.

skywind3000 commented 1 year ago

add this:

export ZLUA_LUAEXE=/path/to/your/lua/executable

after eval "$(lua ...)"

skywind3000 commented 1 year ago

something wrong when getting the absolute path of your lua executable, you can try the above work-around, or try to execute lua with its absolute path name, like:

eval "$(/usr/bin/lua ~/path2z.lua/z.lua  --init bash once enhanced)"
xuan-w commented 1 year ago

Thank you! This solved my problem.

I encountered another strange situation today, not sure if it is relevant. I saw 4 lua processes with high CPU usage even when all terminals were shutdown. In my four years of using your z.lua, I have never seen this. Then I run pkill lua to kill them all.

Edit: Now I see lua5.4 using a lot of CPU frequently. I guess deleting all history could help. Should I submit another issue and close this issue?

xuan-w commented 1 year ago

It seems that my z.lua does have some problem.

I removed ~/.zlua, but it never regenerate. Instead, whenever I cd to a directory, there is a new lua5.4 running, they never quit.

Could you let me know how can I debug this? Thank you!

xuan-w commented 1 year ago

After installing sudo apt-get install lua-filesystem, high CPU usage problem is solved.