archlinux.plugin.zsh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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[pacaur] )); then
  54. alias paupg='pacaur -Syu'
  55. alias pasu='pacaur -Syu --noconfirm'
  56. alias pain='pacaur -S'
  57. alias pains='pacaur -U'
  58. alias pare='pacaur -R'
  59. alias parem='pacaur -Rns'
  60. alias parep='pacaur -Si'
  61. alias pareps='pacaur -Ss'
  62. alias paloc='pacaur -Qi'
  63. alias palocs='pacaur -Qs'
  64. alias palst='pacaur -Qe'
  65. alias paorph='pacaur -Qtd'
  66. alias painsd='pacaur -S --asdeps'
  67. alias pamir='pacaur -Syy'
  68. if (( $+commands[abs] && $+commands[aur] )); then
  69. alias paupd='pacaur -Sy && sudo abs && sudo aur'
  70. elif (( $+commands[abs] )); then
  71. alias paupd='pacaur -Sy && sudo abs'
  72. elif (( $+commands[aur] )); then
  73. alias paupd='pacaur -Sy && sudo aur'
  74. else
  75. alias paupd='pacaur -Sy'
  76. fi
  77. fi
  78. if (( $+commands[trizen] )); then
  79. function upgrade() {
  80. trizen -Syu
  81. }
  82. elif (( $+commands[pacaur] )); then
  83. function upgrade() {
  84. pacaur -Syu
  85. }
  86. elif (( $+commands[yaourt] )); then
  87. function upgrade() {
  88. yaourt -Syu
  89. }
  90. else
  91. function upgrade() {
  92. sudo pacman -Syu
  93. }
  94. fi
  95. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  96. alias pacupg='sudo pacman -Syu'
  97. alias pacin='sudo pacman -S'
  98. alias pacins='sudo pacman -U'
  99. alias pacre='sudo pacman -R'
  100. alias pacrem='sudo pacman -Rns'
  101. alias pacrep='pacman -Si'
  102. alias pacreps='pacman -Ss'
  103. alias pacloc='pacman -Qi'
  104. alias paclocs='pacman -Qs'
  105. alias pacinsd='sudo pacman -S --asdeps'
  106. alias pacmir='sudo pacman -Syy'
  107. alias paclsorphans='sudo pacman -Qdt'
  108. alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
  109. alias pacfileupg='sudo pacman -Fy'
  110. alias pacfiles='pacman -Fs'
  111. alias pacls='pacman -Ql'
  112. alias pacown='pacman -Qo'
  113. if (( $+commands[abs] && $+commands[aur] )); then
  114. alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
  115. elif (( $+commands[abs] )); then
  116. alias pacupd='sudo pacman -Sy && sudo abs'
  117. elif (( $+commands[aur] )); then
  118. alias pacupd='sudo pacman -Sy && sudo aur'
  119. else
  120. alias pacupd='sudo pacman -Sy'
  121. fi
  122. function paclist() {
  123. # Source: https://bbs.archlinux.org/viewtopic.php?id=93683
  124. LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
  125. awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
  126. }
  127. function pacdisowned() {
  128. emulate -L zsh
  129. tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  130. db=$tmp/db
  131. fs=$tmp/fs
  132. mkdir "$tmp"
  133. trap 'rm -rf "$tmp"' EXIT
  134. pacman -Qlq | sort -u > "$db"
  135. find /bin /etc /lib /sbin /usr ! -name lost+found \
  136. \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
  137. comm -23 "$fs" "$db"
  138. }
  139. function pacmanallkeys() {
  140. emulate -L zsh
  141. curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
  142. awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
  143. xargs sudo pacman-key --recv-keys
  144. }
  145. function pacmansignkeys() {
  146. emulate -L zsh
  147. for key in $*; do
  148. sudo pacman-key --recv-keys $key
  149. sudo pacman-key --lsign-key $key
  150. printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
  151. --no-permission-warning --command-fd 0 --edit-key $key
  152. done
  153. }
  154. if (( $+commands[xdg-open] )); then
  155. function pacweb() {
  156. pkg="$1"
  157. infos="$(pacman -Si "$pkg")"
  158. if [[ -z "$infos" ]]; then
  159. return
  160. fi
  161. repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
  162. arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
  163. xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
  164. }
  165. fi