diff --git a/lf/lfcd.sh b/lf/lfcd.sh new file mode 100644 index 0000000..e35199a --- /dev/null +++ b/lf/lfcd.sh @@ -0,0 +1,20 @@ +# Change working dir in shell to last dir in lf on exit (adapted from ranger). +# +# You need to either copy the content of this file to your shell rc file +# (e.g. ~/.bashrc) or source this file directly: +# +# LFCD="/path/to/lfcd.sh" +# if [ -f "$LFCD" ]; then +# source "$LFCD" +# fi +# +# You may also like to assign a key (Ctrl-O) to this command: +# +# bind '"\C-o":"lfcd\C-m"' # bash +# bindkey -s '^o' 'lfcd\n' # zsh +# + +lfcd () { + # `command` is needed in case `lfcd` is aliased to `lf` + cd "$(command lf -print-last-dir "$@")" +} diff --git a/lf/lfrc b/lf/lfrc index a23ad81..80ccc31 100644 --- a/lf/lfrc +++ b/lf/lfrc @@ -1,4 +1,3 @@ -#-----------------------------------------------------------------------------# # File: ~/.config/lf/lfrc (archlinux @ 'silent') # Date: Thu 15 Mar 2022 12:05 # Update: Mon 08 Jul 2024 22:04 @@ -252,12 +251,12 @@ cmd bulkrename $vidir map "'" map '"' map , - map c - map d - map e $ open "$PWD" - map m - map r - +map c +map d +map e $ open "$PWD" +map m +map r +map ZZ quit # escape map :unselect;clear;