From 324855aab7ea201ff7ba8c3bb7362a0a96800499 Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Sun, 25 Aug 2024 15:37:45 +0200 Subject: [PATCH] bash: support dirchange on exit (lf) --- home/dot-bashrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home/dot-bashrc b/home/dot-bashrc index 603a05b4..5491c410 100644 --- a/home/dot-bashrc +++ b/home/dot-bashrc @@ -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 -- 2.51.2