add cdlf and lfcd functions

This commit is contained in:
Ray Elliott 2020-06-30 16:57:45 +01:00
parent 9f992fef60
commit d114544614
1 changed files with 12 additions and 1 deletions

View File

@ -61,9 +61,20 @@ function npm {
# lf gets confused by TERMINFO env var when running in tmux
# https://github.com/gokcehan/lf/issues/138#issuecomment-464477665
if [ -n "$TERMINFO" ] ; then
alias lf="TERMINFO= lf"
alias lf="TERMINFO= lf -last-dir-path=$HOME/.cache/lf-last-dir"
else
alias lf="lf -last-dir-path=$HOME/.cache/lf-last-dir"
fi
cdlf() {
cd "$(cat $HOME/.cache/lf-last-dir)"
}
lfcd() {
lf -last-dir-path="$HOME"/.cache/lf-last-dir
cdlf
}
# functions
# $1 - output directory
# $2 - size