skywind3000 / skywind3000/z.lua

cannot get ranger_zlua.py working

Open
#213 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
3.1k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ranger_zlua.py and the ranger plugin instructions in README.md, then reproduce the reported setup using the ZLUA_LUAEXE and ZLUA_SCRIPT values shown. Check how the plugin receives those environment variables when ranger starts. Done means confirming a working configuration or documenting the required setup and adding the requested command help if appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, lua, python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.