archlinux.plugin.zsh 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. if (( $+commands[trizen] )); then
  2. alias trconf='trizen -C'
  3. alias trupg='trizen -Syua'
  4. alias trsu='trizen -Syua --noconfirm'
  5. alias trin='trizen -S'
  6. alias trins='trizen -U'
  7. alias trre='trizen -R'
  8. alias trrem='trizen -Rns'
  9. alias trrep='trizen -Si'
  10. alias trreps='trizen -Ss'
  11. alias trloc='trizen -Qi'
  12. alias trlocs='trizen -Qs'
  13. alias trlst='trizen -Qe'
  14. alias trorph='trizen -Qtd'
  15. alias trinsd='trizen -S --asdeps'
  16. alias trmir='trizen -Syy'
  17. if (( $+commands[abs] && $+commands[aur] )); then
  18. alias trupd='trizen -Sy && sudo abs && sudo aur'
  19. elif (( $+commands[abs] )); then
  20. alias trupd='trizen -Sy && sudo abs'
  21. elif (( $+commands[aur] )); then
  22. alias trupd='trizen -Sy && sudo aur'
  23. else
  24. alias trupd='trizen -Sy'
  25. fi
  26. fi
  27. if (( $+commands[yaourt] )); then
  28. alias yaconf='yaourt -C'
  29. alias yaupg='yaourt -Syua'
  30. alias yasu='yaourt -Syua --noconfirm'
  31. alias yain='yaourt -S'
  32. alias yains='yaourt -U'
  33. alias yare='yaourt -R'
  34. alias yarem='yaourt -Rns'
  35. alias yarep='yaourt -Si'
  36. alias yareps='yaourt -Ss'
  37. alias yaloc='yaourt -Qi'
  38. alias yalocs='yaourt -Qs'
  39. alias yalst='yaourt -Qe'
  40. alias yaorph='yaourt -Qtd'
  41. alias yainsd='yaourt -S --asdeps'
  42. alias yamir='yaourt -Syy'
  43. if (( $+commands[abs] && $+commands[aur] )); then
  44. alias yaupd='yaourt -Sy && sudo abs && sudo aur'
  45. elif (( $+commands[abs] )); then
  46. alias yaupd='yaourt -Sy && sudo abs'
  47. elif (( $+commands[aur] )); then
  48. alias yaupd='yaourt -Sy && sudo aur'
  49. else
  50. alias yaupd='yaourt -Sy'
  51. fi
  52. fi
  53. if (( $+commands[yay] )); then
  54. alias yaconf='yay -Pg'
  55. alias yaupg='yay -Syu'
  56. alias yasu='yay -Syu --noconfirm'
  57. alias yain='yay -S'
  58. alias yains='yay -U'
  59. alias yare='yay -R'
  60. alias yarem='yay -Rns'
  61. alias yarep='yay -Si'
  62. alias yareps='yay -Ss'
  63. alias yaloc='yay -Qi'
  64. alias yalocs='yay -Qs'
  65. alias yalst='yay -Qe'
  66. alias yaorph='yay -Qtd'
  67. alias yainsd='yay -S --asdeps'
  68. alias yamir='yay -Syy'
  69. if (( $+commands[abs] && $+commands[aur] )); then
  70. alias yaupd='yay -Sy && sudo abs && sudo aur'
  71. elif (( $+commands[abs] )); then
  72. alias yaupd='yay -Sy && sudo abs'
  73. elif (( $+commands[aur] )); then
  74. alias yaupd='yay -Sy && sudo aur'
  75. else
  76. alias yaupd='yay -Sy'
  77. fi
  78. fi
  79. if (( $+commands[pacaur] )); then
  80. alias paupg='pacaur -Syu'
  81. alias pasu='pacaur -Syu --noconfirm'
  82. alias pain='pacaur -S'
  83. alias pains='pacaur -U'
  84. alias pare='pacaur -R'
  85. alias parem='pacaur -Rns'
  86. alias parep='pacaur -Si'
  87. alias pareps='pacaur -Ss'
  88. alias paloc='pacaur -Qi'
  89. alias palocs='pacaur -Qs'
  90. alias palst='pacaur -Qe'
  91. alias paorph='pacaur -Qtd'
  92. alias painsd='pacaur -S --asdeps'
  93. alias pamir='pacaur -Syy'
  94. if (( $+commands[abs] && $+commands[aur] )); then
  95. alias paupd='pacaur -Sy && sudo abs && sudo aur'
  96. elif (( $+commands[abs] )); then
  97. alias paupd='pacaur -Sy && sudo abs'
  98. elif (( $+commands[aur] )); then
  99. alias paupd='pacaur -Sy && sudo aur'
  100. else
  101. alias paupd='pacaur -Sy'
  102. fi
  103. fi
  104. if (( $+commands[trizen] )); then
  105. function upgrade() {
  106. trizen -Syu
  107. }
  108. elif (( $+commands[pacaur] )); then
  109. function upgrade() {
  110. pacaur -Syu
  111. }
  112. elif (( $+commands[yaourt] )); then
  113. function upgrade() {
  114. yaourt -Syu
  115. }
  116. elif (( $+commands[yay] )); then
  117. function upgrade() {
  118. yay -Syu
  119. }
  120. else
  121. function upgrade() {
  122. sudo pacman -Syu
  123. }
  124. fi
  125. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  126. alias pacupg='sudo pacman -Syu'
  127. alias pacin='sudo pacman -S'
  128. alias pacins='sudo pacman -U'
  129. alias pacre='sudo pacman -R'
  130. alias pacrem='sudo pacman -Rns'
  131. alias pacrep='pacman -Si'
  132. alias pacreps='pacman -Ss'
  133. alias pacloc='pacman -Qi'
  134. alias paclocs='pacman -Qs'
  135. alias pacinsd='sudo pacman -S --asdeps'
  136. alias pacmir='sudo pacman -Syy'
  137. alias paclsorphans='sudo pacman -Qdt'
  138. alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
  139. alias pacfileupg='sudo pacman -Fy'
  140. alias pacfiles='pacman -F'
  141. alias pacls='pacman -Ql'
  142. alias pacown='pacman -Qo'
  143. if (( $+commands[abs] && $+commands[aur] )); then
  144. alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
  145. elif (( $+commands[abs] )); then
  146. alias pacupd='sudo pacman -Sy && sudo abs'
  147. elif (( $+commands[aur] )); then
  148. alias pacupd='sudo pacman -Sy && sudo aur'
  149. else
  150. alias pacupd='sudo pacman -Sy'
  151. fi
  152. function paclist() {
  153. # Source: https://bbs.archlinux.org/viewtopic.php?id=93683
  154. LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
  155. awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
  156. }
  157. function pacdisowned() {
  158. emulate -L zsh
  159. tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  160. db=$tmp/db
  161. fs=$tmp/fs
  162. mkdir "$tmp"
  163. trap 'rm -rf "$tmp"' EXIT
  164. pacman -Qlq | sort -u > "$db"
  165. find /bin /etc /lib /sbin /usr ! -name lost+found \
  166. \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
  167. comm -23 "$fs" "$db"
  168. }
  169. function pacmanallkeys() {
  170. emulate -L zsh
  171. curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
  172. awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
  173. xargs sudo pacman-key --recv-keys
  174. }
  175. function pacmansignkeys() {
  176. emulate -L zsh
  177. for key in $*; do
  178. sudo pacman-key --recv-keys $key
  179. sudo pacman-key --lsign-key $key
  180. printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
  181. --no-permission-warning --command-fd 0 --edit-key $key
  182. done
  183. }
  184. if (( $+commands[xdg-open] )); then
  185. function pacweb() {
  186. pkg="$1"
  187. infos="$(LANG=C pacman -Si "$pkg")"
  188. if [[ -z "$infos" ]]; then
  189. return
  190. fi
  191. repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
  192. arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
  193. xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
  194. }
  195. fi