Configuration for my NixOS based systems and Home Manager
at othinus 27 lines 707 B view 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 to this command: 9# 10# bind \co 'lfcd; commandline -f repaint' 11# 12# You need to put this in a function called fish_user_key_bindings. 13 14function lfcd 15 set tmp (mktemp) 16 lf -last-dir-path=$tmp $argv 17 if test -f "$tmp" 18 set dir (cat $tmp) 19 rm -f $tmp 20 if test -d "$dir" 21 if test "$dir" != (pwd) 22 cd $dir 23 ls 24 end 25 end 26 end 27end