Debian Codegraph @

etc/lfcd.fish

raw
1 # Change working dir in fish to last dir in lf on exit (adapted from ranger).
2 #
3 # You may put this file to a directory in $fish_function_path variable:
4 #
5 # mkdir -p ~/.config/fish/functions
6 # ln -s "/path/to/lfcd.fish" ~/.config/fish/functions
7 #
8 # You may also like to assign a key (Ctrl-O) to this command:
9 #
10 # bind \co 'set old_tty (stty -g); stty sane; lfcd; stty $old_tty; commandline -f repaint'
11 #
12 # You may put this in a function called fish_user_key_bindings.
13
14 function lfcd --wraps="lf" --description="lf - Terminal file manager (changing directory on exit)"
15 # `command` is needed in case `lfcd` is aliased to `lf`.
16 # Quotes will cause `cd` to not change directory if `lf` prints nothing to stdout due to an error.
17 cd "$(command lf -print-last-dir $argv)"
18 end