]> Freerunner's - dotfiles.git/commitdiff
bash: support dirchange on exit (lf)
authorAndre Ramnitz <tux.rising@gmail.com>
Sun, 25 Aug 2024 13:37:45 +0000 (15:37 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Mon, 26 Aug 2024 13:52:01 +0000 (15:52 +0200)
home/dot-bashrc

index 603a05b4c3f42c9cd3a5dde49f87615cd8b8cdca..5491c4103ae845c97fafbd2630836e6b86310797 100644 (file)
@@ -148,6 +148,12 @@ shopt -s nocaseglob
 # expand filename patterns without match to a null string
 shopt -s nullglob
 
+# Change working dir in shell to last dir in lf on exit (adapted from ranger).
+lfcd () {
+    # `command` is needed in case `lfcd` is aliased to `lf`
+    cd "$(command lf -print-last-dir "$@")"
+}
+
 # Put your fun stuff here.
 #
 #[ -x /bin/fish ] && SHELL=/bin/fish exec fish