Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot get ranger_zlua.py working #213

Open
m040601 opened this issue Jan 31, 2025 · 0 comments
Open

cannot get ranger_zlua.py working #213

m040601 opened this issue Jan 31, 2025 · 0 comments

Comments

@m040601
Copy link

m040601 commented Jan 31, 2025

Hi, thanks for all the work on z.lua. Nice to see the repository still active and the tool cared for.
I love it and have been using all these years

I am trying to use it with ranger.

I read what the ranger wiki says, https://github.com/ranger/ranger.
And what z.lua says, /usr/share/z.lua/README.md,

copy the `ranger_zlua.py` file to `~/.config/ranger/plugins/`.

Question 1
I am not 100% sure. Should I also chmod +x it ? I did it anyway

Question 2

# $RANGER_LUA and $RANGER_ZLUA variables are deprecated, do not use them.
ZLUA_LUAEXE = os.environ.get('RANGER_LUA') or os.environ.get('ZLUA_LUAEXE')
ZLUA_SCRIPT = os.environ.get('RANGER_ZLUA') or os.environ.get('ZLUA_SCRIPT')

No matter what I tried I cannot have it working.

ranger_zlua: Could not find z.lua, please make sure $ZLUA_SCRIPT is set to absolute path of z.lua.
Error while loading plugin 'ranger_zlua'

I have a standard Archlinux installation. No hacks, not customizations.
I have on my bashrc

eval "$(lua /usr/share/z.lua/z.lua  --init bash enhanced once )"

On my shell

$ echo $ZLUA_LUAEXE

/usr/bin/lua

$ echo $ZLUA_SCRIPT

/usr/share/z.lua/z.lua

Are correctly displayed.

The only way I found was to hardcode and change in ranger_zlua.py both

ZLUA_LUAEXE = "/usr/bin/lua"
ZLUA_SCRIPT = "/usr/share/z.lua/z.lua"

Then it works.

I am not a developer. Not very proficient with git. The only possibly related
stuff I found were these commits from 2 years ago,

f347eaf 2Y Ilya Grigoriev  o Slight stylistic edits to `ranger_zlua.py`
e11d2e2 2Y Ilya Grigoriev  o Fixes and docs for the ranger plugin
9dc5875 4Y Sami Kankaristo o Fix `z -I` in ranger_zlua.py
1e0e352 5Y skywind3000     I add ranger plugin for z.lua
-PATH_LUA = os.environ.get('RANGER_LUA') or os.environ.get('ZLUA_LUAEXE')
-PATH_ZLUA = os.environ.get('RANGER_ZLUA') or os.environ.get('ZLUA_SCRIPT')
+ZLUA_LUAEXE = os.environ.get('RANGER_LUA') or os.environ.get('ZLUA_LUAEXE')
+ZLUA_SCRIPT = os.environ.get('RANGER_ZLUA') or os.environ.get('ZLUA_SCRIPT')

Could you confirm me that "ranger_lua.py" is up to date and properly working on your own system ?

By the way. You have

......
# class z(ranger.api.commands.Command):
    def execute (self):
        import sys, os, time
        .....

When youu press "?" for help, and then "c" for commands in ranger, a help page shows up for that :command.

You could add something for example,

# class z(ranger.api.commands.Command):
    """
    :z <foo>
    :z -i <foo>

    You can also put `alias zb z -b` into `~/.config/ranger/rc.conf`.
    Bla bla bla ... does this and that ....
    Bla bla bla ... does this and that ....
    Example usage ... foo ... bar
    """
    def execute (self):
        import sys, os, time
        ....

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant