directories.zsh 808 B

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