Usually, j something
switches the working directory. But it doesn't have to. In some cases, we simply need to have the directory printed to stdout. e.g.
open `j --no-cd something`
This could launch the Finder on OS X for the destination directory.
I don't know whether it is hard to hack out this feature, but thanks any way for the great tool!
Hmm, feels like exactly what I was thinking for https://github.com/hut/ranger/issues/91.
jo <dir>
opens OS specific file browser.
autojump <dir>
prints the first match. If not passed any arguments, autojump prints the most frequently used directory.
If you need more information, use autojump --stats
and any combination of awk / sed / tr / etc.
I prefer fasd, and I wrote this to give me a :j command. You could probably
adapt it to autojump.
Put this in .config/ranger/commands.py:
from ranger.api.commands import *
import subprocess
class j(Command):
""":j
Uses fasd to set the current directory.
"""
def execute(self):
directory = subprocess.check_output(["fasd", "-dl1", self.arg(1)])
directory = directory.decode("utf-8", "ignore")
directory = directory.rstrip('\n')
self.fm.execute_console("cd " + directory)
Most helpful comment
I prefer fasd, and I wrote this to give me a :j command. You could probably
adapt it to autojump.
Put this in .config/ranger/commands.py: