Open CyberShadow opened 10 months ago
I think the easiest way forward here is probably to patch what the wrapper script would do directly into the ranger
script.
Hello, is there any more interest in adding this capability? I use this very frequently on non-nix machines.
@IogaMaster Are you still working on this?
A possible workaround is to use yazi, which has a that functionality available as an alias as well: https://yazi-rs.github.io/docs/quick-start#shell-wrapper
Yazi is also a lot faster than ranger, and is regularly getting new releases.
EDIT: I feel a bit bad for saying this, right in front of one of the maintainers of ranger. Sorry @toonn, just know that imitation is the highest form of flattery, and ranger has spawned a whole slew of copycats!
A possible workaround is to use yazi, which has a that functionality available as an alias as well:
Sorry, I don't understand. How does that help work around the problem here?
I tried nix-shell -p yazi
and then both yazi
and . yazi
but neither allowed me to exit the file manager while preserving the current directory when returning to the shell.
There's a few lines of code in a couple shell languages here: https://yazi-rs.github.io/docs/quick-start#shell-wrapper Those will create a function that opens yazi (a ranger clone) and when you close yazi, you'll "be returned to shell, in the directory browsed to in step 2." (quote from the first comment in this issue)
I completly forgot i added myself to this I will take a look this weekend
Describe the bug
In most distributions, one is able to e.g.
alias r=". ranger"
in their shell. Sourcing theranger
entry point script makes it preserve the current directory to the one that was being browsed in the file manager before quitting it.However, this does not work in the nixpkgs version, because
ranger
is anixpkgs
-generated wrapper which usesexec
, and thus cannot be sourced with the same effect.Steps To Reproduce
Steps to reproduce the behavior:
. ranger
q
to quit RangerExpected behavior
The user should be returned to shell, in the directory browsed to in step 2.
Additional context
https://github.com/ranger/ranger/blob/136416c7e2ecc27315fe2354ecadfe09202df7dd/ranger.py#L6-L24
Notify maintainers
@toonn @magnetophon
Metadata
"x86_64-linux"
Linux 6.5.4-arch2-1, Arch Linux, noversion, rolling
yes
yes
nix-env (Nix) 2.17.0
/nix/store/l3bc30i71qshxa3mdj3dy8dj7zwqkh6s-source