You are not logged in.
I added an Extract function to my .zshrc it works fine within Zsh. When I mapped it to a key in ranger, it did not work. Here is how I mapped it (rc.conf)
map X shell extract %f Is there a way to use my Shell functions with Ranger or I have to put them in separate scripts
Last edited by iduoad (2018-03-26 21:02:17)
Offline
I suggest creating a simple shell script using desired function and map it in ~/.config/ranger/rifle.conf
ie:
ext zip = myscript.sh "$@"
ext tar.gz = myscript.sh "$@"maybe this would work too
ext tar.gz = map X shell extract %f "$@"
ext zip = map X shell extract %f "$@"Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline
Actually I have a lot of functions that I've like to bind them to something in Ranger. And I don't want to create separate scripts for all of them.
Offline
Learn how ranger works
https://wiki.archlinux.org/index.php/ra … ssociation
your shell alias && functions will not work in ranger without some editing of ~/.config/ranger/rifle.conf, functions that are more than one liners will need a script to work, if you dont want to create said scripts, then dont.
Also note the examples of the scripts used for extracting && compressing from above wiki link.
Last edited by cirrus (2018-03-26 21:31:39)
Ancestoral Clan https://cirrus.freevar.com/mclean.html
Offline
This is not a ranger issue, it's just general shell use:
Is there a way to use my Shell functions with Ranger or I have to put them in separate scripts
Shell functions are only defined in interactive shells. I just took a quick look and I don't see any obvious way to pass the '-i' flag to the shell that ranger spawns, but it certainly could be done. Short of that, you can specify it in your commands directly:
map X sh -i -c shell extract %fThough this is pretty ugly if you ask me.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline