directories.zsh 786 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Changing/making/removing directory
  2. setopt auto_pushd
  3. setopt pushd_ignore_dups
  4. setopt pushdminus
  5. alias ..='cd ..'
  6. alias cd..='cd ..'
  7. alias cd...='cd ../..'
  8. alias cd....='cd ../../..'
  9. alias cd.....='cd ../../../..'
  10. alias cd/='cd /'
  11. alias 1='cd -'
  12. alias 2='cd -2'
  13. alias 3='cd -3'
  14. alias 4='cd -4'
  15. alias 5='cd -5'
  16. alias 6='cd -6'
  17. alias 7='cd -7'
  18. alias 8='cd -8'
  19. alias 9='cd -9'
  20. cd () {
  21. if [[ "x$*" == "x..." ]]; then
  22. cd ../..
  23. elif [[ "x$*" == "x...." ]]; then
  24. cd ../../..
  25. elif [[ "x$*" == "x....." ]]; then
  26. cd ../../../..
  27. elif [[ "x$*" == "x......" ]]; then
  28. cd ../../../../..
  29. elif [ -d ~/.autoenv ]; then
  30. source ~/.autoenv/activate.sh
  31. autoenv_cd "$@"
  32. else
  33. builtin cd "$@"
  34. fi
  35. }
  36. alias md='mkdir -p'
  37. alias rd=rmdir
  38. alias d='dirs -v | head -10'