Skip to content

cannot get ranger_zlua.py working #213

Open
@m040601

Description

@m040601

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions