lf.sh 414 B

123456789101112131415161718192021
  1. if test "$OS" = "Windows_NT" ; then
  2. lf() {
  3. winpty lf
  4. }
  5. fi
  6. lfcd () {
  7. tmp="$(mktemp)"
  8. # `command` is needed in case `lfcd` is aliased to `lf`
  9. command lf -last-dir-path="$tmp" "$@"
  10. if test -f "$tmp" ; then
  11. dir="$(cat "$tmp")"
  12. rm -f "$tmp"
  13. if [ -d "$dir" ]; then
  14. if [ "$dir" != "$(pwd)" ]; then
  15. cd "$dir"
  16. fi
  17. fi
  18. fi
  19. pwd
  20. }