def hook_init(fm): def zoxide_add(signal): Popen(["zoxide", "add", signal.new.path]) fm.signal_bind("cd", zoxide_add) fm.commands.alias("zi", "z -i") return hook_init_prev(fm)
def hook_init(fm: ranger.core.fm.FM): def zoxide_add(signal: ranger.ext.signals.Signal): path = signal.new.path process = subprocess.Popen(["zoxide", "add", path]) process.wait() fm.signal_bind("cd", zoxide_add) return hook_init_old(fm)
def hook_init(fm:ranger.core.fm.FM): def fasd_add(): fm.execute_console("shell fasd --add " + quote(fm.thisfile.path)) fm.signal_bind('execute.before', fasd_add) # def fasd_add_dir(): # fm.execute_console("shell fasd --add " + quote(fm.thisdir.path)) # fm.signal_bind('cd', fasd_add_dir) return old_hook_init(fm)
def hook_init(fm): def zoxide_add(signal): path = signal.new.path process = Popen(["zoxide", "add", path]) process.wait() fm.signal_bind("cd", zoxide_add) return hook_init_prev(fm)
def hook_init(fm: ranger.core.fm.FM): def zoxide_add(signal: ranger.ext.signals.Signal): path = signal.new.path try: process = subprocess.Popen(["zoxide", "add", path]) process.wait() except FileNotFoundError: return fm.signal_bind("cd", zoxide_add) return hook_init_old(fm)