diff options
| author | twells46 <173561638+twells46@users.noreply.github.com> | 2025-12-31 13:28:05 -0600 |
|---|---|---|
| committer | twells46 <173561638+twells46@users.noreply.github.com> | 2025-12-31 13:28:05 -0600 |
| commit | 2140ab51deed88e90eafebf9520fa5f9995dc7c9 (patch) | |
| tree | 03cf1dcd2900495c1efb79aaa85f3254ecd5fb87 /dot_config/fish/functions/lfcd.fish | |
| parent | ff8f50638e4b17a9d7cc88d2f0d9560b7effce39 (diff) | |
Migrate from stow
Diffstat (limited to 'dot_config/fish/functions/lfcd.fish')
| -rw-r--r-- | dot_config/fish/functions/lfcd.fish | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dot_config/fish/functions/lfcd.fish b/dot_config/fish/functions/lfcd.fish new file mode 100644 index 0000000..9007021 --- /dev/null +++ b/dot_config/fish/functions/lfcd.fish @@ -0,0 +1,18 @@ +# Change working dir in fish to last dir in lf on exit (adapted from ranger). +# +# You may put this file to a directory in $fish_function_path variable: +# +# mkdir -p ~/.config/fish/functions +# ln -s "/path/to/lfcd.fish" ~/.config/fish/functions +# +# You may also like to assign a key (Ctrl-O) to this command: +# +# bind \co 'set old_tty (stty -g); stty sane; lfcd; stty $old_tty; commandline -f repaint' +# +# You may put this in a function called fish_user_key_bindings. + +function lfcd --wraps="lf" --description="lf - Terminal file manager (changing directory on exit)" + # `command` is needed in case `lfcd` is aliased to `lf`. + # Quotes will cause `cd` to not change directory if `lf` prints nothing to stdout due to an error. + cd "$(command lf -print-last-dir $argv)" +end |