init.zsh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #
  2. # Defines Homebrew aliases.
  3. #
  4. # Authors:
  5. # Sorin Ionescu <sorin.ionescu@gmail.com>
  6. #
  7. # Load dependencies.
  8. pmodload 'helper'
  9. # Return if requirements are not found.
  10. if ! is-darwin && ! is-linux; then
  11. return 1
  12. fi
  13. #
  14. # Variables
  15. #
  16. # Load standard Homebrew shellenv into the shell session.
  17. # Load 'HOMEBREW_' prefixed variables only. Avoid loading 'PATH' related
  18. # variables as they are already handled in standard zsh configuration.
  19. if (( $+commands[brew] )); then
  20. cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/brew-shellenv-cache.zsh"
  21. if [[ "$commands[brew]" -nt "$cache_file" \
  22. || "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
  23. || ! -s "$cache_file" ]]; then
  24. mkdir -p "$cache_file:h"
  25. # Cache the result.
  26. echo "${(@M)${(f)"$(brew shellenv 2> /dev/null)"}:#export HOMEBREW*}" >! "$cache_file" 2> /dev/null
  27. fi
  28. source "$cache_file"
  29. unset cache_file
  30. fi
  31. #
  32. # Aliases
  33. #
  34. # Homebrew
  35. if ! zstyle -t ':prezto:module:homebrew:alias' skip; then
  36. alias brewc='brew cleanup'
  37. alias brewi='brew install'
  38. alias brewL='brew leaves'
  39. alias brewl='brew list'
  40. alias brewo='brew outdated'
  41. alias brews='brew search'
  42. alias brewu='brew upgrade'
  43. alias brewx='brew uninstall'
  44. # Homebrew Cask
  45. alias caski='brew install --cask'
  46. alias caskl='brew list --cask'
  47. alias casko='brew outdated --cask'
  48. alias casks='brew search --cask'
  49. alias casku='brew upgrade --cask'
  50. alias caskx='brew uninstall --cask'
  51. fi