27 lines
786 B
Bash
27 lines
786 B
Bash
# 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
|
|
#
|
|
# If you are a ZSH user, and have installed ZSH completions for LF,
|
|
# you may also like to enable them for `lfcd` as well.
|
|
# To do so, after sourcing/defining `lfcd` function, put the following line:
|
|
#
|
|
# compdef _lf lfcd
|
|
#
|
|
|
|
lfcd () {
|
|
# `command` is needed in case `lfcd` is aliased to `lf`
|
|
cd "$(command lf -print-last-dir "$@")"
|
|
}
|