init.zsh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #
  2. # Pacman aliases
  3. #
  4. # ${zpacman_frontend} is provided by either .zimrc or (if not set) init.zsh
  5. # The zpacman_frontend is _only_ used for package installs.
  6. #
  7. # Setup
  8. #
  9. # ensure pacman is available
  10. if (( ! ${+commands[pacman]} )); then
  11. return 1
  12. fi
  13. local zpacman_frontend_priv helper
  14. if (( ! ${+zpacman_frontend} )); then
  15. zpacman_frontend='pacman'
  16. zpacman_frontend_priv='sudo pacman'
  17. elif (( ! ${+commands[${zpacman_frontend}]} )); then
  18. print "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\".
  19. You can fix this error by editing the 'zpacman_frontend' variable in your .zimrc" >&2
  20. zpacman_frontend='pacman'
  21. zpacman_frontend_priv='sudo pacman'
  22. elif [[ ${zpacman_frontend} == ("yaourt"|"pacaur"|"yay"|"pikaur") ]]; then
  23. # those AUR helpers handle SUID themselves
  24. zpacman_frontend_priv="${zpacman_frontend}"
  25. else
  26. zpacman_frontend_priv="sudo ${zpacman_frontend}"
  27. fi
  28. #
  29. # General
  30. #
  31. alias pac=${zpacman_frontend}
  32. #
  33. # Build
  34. #
  35. # build package in current directory, cleanup, and install
  36. alias pacb='makepkg -sci'
  37. #
  38. # Install
  39. #
  40. #NOTE: Installing/upgrading individual packages is NOT supported. Sync and upgrade ALL on install.
  41. # install, sync, and upgrade packages
  42. alias paci="${zpacman_frontend_priv} -Syu"
  43. # install packages without syncing
  44. alias pacI="${zpacman_frontend_priv} -S"
  45. # install, sync, and upgrade packages (forcibly refresh package lists)
  46. alias pacu="${zpacman_frontend_priv} -Syyu"
  47. # install packages by filename
  48. alias pacU="${zpacman_frontend_priv} -U"
  49. # install all packages in current directory
  50. alias pacd="${zpacman_frontend_priv} -U *.pkg.*"
  51. #
  52. # Remove
  53. #
  54. # remove package and unneeded dependencies
  55. alias pacr="${zpacman_frontend_priv} -R"
  56. # remove package, unneeded dependencies, and configuration files
  57. alias pacrm="${zpacman_frontend_priv} -Rns"
  58. #
  59. # Query
  60. #
  61. # query package information from the remote repository
  62. alias pacq="${zpacman_frontend} -Si"
  63. # query package information from the local repository
  64. alias pacQ="${zpacman_frontend} -Qi"
  65. #
  66. # Search
  67. #
  68. # search for package in the remote repository
  69. alias pacs="${zpacman_frontend} -Ss"
  70. # search for the package in the local repository
  71. alias pacS="${zpacman_frontend} -Qs"
  72. #
  73. # Orphans
  74. #
  75. # list orphan packages
  76. alias pacol="${zpacman_frontend} -Qdt"
  77. # remove orphan packages
  78. alias pacor="${zpacman_frontend_priv} -Rns \$(pacman -Qtdq)"
  79. #
  80. # Ownership
  81. #
  82. # list all files that belong to a package
  83. alias pacown="${zpacman_frontend} -Ql"
  84. # show package(s) owning the specified file
  85. alias pacblame="${zpacman_frontend} -Qo"
  86. #
  87. # Helpers
  88. #
  89. # source helper functions/aliases
  90. for helper in ${zpacman_helper}; do
  91. if [[ -s ${0:h}/helper_${helper}.zsh ]]; then
  92. source ${0:h}/helper_${helper}.zsh
  93. else
  94. print "no such helper script \"helper_${helper}.zsh\"" >&2
  95. fi
  96. done