archlinux.plugin.zsh 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. #######################################
  2. # Pacman #
  3. #######################################
  4. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  5. alias pacupg='sudo pacman -Syu'
  6. alias pacin='sudo pacman -S'
  7. alias pacins='sudo pacman -U'
  8. alias pacre='sudo pacman -R'
  9. alias pacrem='sudo pacman -Rns'
  10. alias pacrep='pacman -Si'
  11. alias pacreps='pacman -Ss'
  12. alias pacloc='pacman -Qi'
  13. alias paclocs='pacman -Qs'
  14. alias pacinsd='sudo pacman -S --asdeps'
  15. alias pacmir='sudo pacman -Syy'
  16. alias paclsorphans='sudo pacman -Qdt'
  17. alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
  18. alias pacfileupg='sudo pacman -Fy'
  19. alias pacfiles='pacman -F'
  20. alias pacls='pacman -Ql'
  21. alias pacown='pacman -Qo'
  22. alias pacupd="sudo pacman -Sy"
  23. alias upgrade='sudo pacman -Syu'
  24. function paclist() {
  25. # Based on https://bbs.archlinux.org/viewtopic.php?id=93683
  26. pacman -Qqe | \
  27. xargs -I '{}' \
  28. expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}'
  29. }
  30. function pacdisowned() {
  31. local tmp db fs
  32. tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  33. db=$tmp/db
  34. fs=$tmp/fs
  35. mkdir "$tmp"
  36. trap 'rm -rf "$tmp"' EXIT
  37. pacman -Qlq | sort -u > "$db"
  38. find /bin /etc /lib /sbin /usr ! -name lost+found \
  39. \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
  40. comm -23 "$fs" "$db"
  41. }
  42. alias pacmanallkeys='sudo pacman-key --refresh-keys'
  43. function pacmansignkeys() {
  44. local key
  45. for key in $@; do
  46. sudo pacman-key --recv-keys $key
  47. sudo pacman-key --lsign-key $key
  48. printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
  49. --no-permission-warning --command-fd 0 --edit-key $key
  50. done
  51. }
  52. if (( $+commands[xdg-open] )); then
  53. function pacweb() {
  54. if [[ $# = 0 || "$1" =~ '--help|-h' ]]; then
  55. local underline_color="\e[${color[underline]}m"
  56. echo "$0 - open the website of an ArchLinux package"
  57. echo
  58. echo "Usage:"
  59. echo " $bold_color$0$reset_color ${underline_color}target${reset_color}"
  60. return 1
  61. fi
  62. local pkg="$1"
  63. local infos="$(LANG=C pacman -Si "$pkg")"
  64. if [[ -z "$infos" ]]; then
  65. return
  66. fi
  67. local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
  68. local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
  69. xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
  70. }
  71. fi
  72. #######################################
  73. # AUR helpers #
  74. #######################################
  75. if (( $+commands[aura] )); then
  76. alias auin='sudo aura -S'
  77. alias aurin='sudo aura -A'
  78. alias auins='sudo aura -U'
  79. alias auinsd='sudo aura -S --asdeps'
  80. alias aurinsd='sudo aura -A --asdeps'
  81. alias auloc='aura -Qi'
  82. alias aulocs='aura -Qs'
  83. alias aulst='aura -Qe'
  84. alias aumir='sudo aura -Syy'
  85. alias aurph='sudo aura -Oj'
  86. alias aure='sudo aura -R'
  87. alias aurem='sudo aura -Rns'
  88. alias aurep='aura -Si'
  89. alias aurrep='aura -Ai'
  90. alias aureps='aura -As --both'
  91. alias auras='aura -As --both'
  92. alias auupd="sudo aura -Sy"
  93. alias auupg='sudo sh -c "aura -Syu && aura -Au"'
  94. alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
  95. alias upgrade='sudo aura -Syu'
  96. # extra bonus specially for aura
  97. alias auown="aura -Qqo"
  98. alias auls="aura -Qql"
  99. function auownloc() { aura -Qi $(aura -Qqo $@); }
  100. function auownls () { aura -Qql $(aura -Qqo $@); }
  101. fi
  102. if (( $+commands[pacaur] )); then
  103. alias paupg='pacaur -Syu'
  104. alias pasu='pacaur -Syu --noconfirm'
  105. alias pain='pacaur -S'
  106. alias pains='pacaur -U'
  107. alias pare='pacaur -R'
  108. alias parem='pacaur -Rns'
  109. alias parep='pacaur -Si'
  110. alias pareps='pacaur -Ss'
  111. alias paloc='pacaur -Qi'
  112. alias palocs='pacaur -Qs'
  113. alias palst='pacaur -Qe'
  114. alias paorph='pacaur -Qtd'
  115. alias painsd='pacaur -S --asdeps'
  116. alias pamir='pacaur -Syy'
  117. alias paupd="pacaur -Sy"
  118. alias upgrade='pacaur -Syu'
  119. fi
  120. if (( $+commands[trizen] )); then
  121. alias trconf='trizen -C'
  122. alias trupg='trizen -Syua'
  123. alias trsu='trizen -Syua --noconfirm'
  124. alias trin='trizen -S'
  125. alias trins='trizen -U'
  126. alias trre='trizen -R'
  127. alias trrem='trizen -Rns'
  128. alias trrep='trizen -Si'
  129. alias trreps='trizen -Ss'
  130. alias trloc='trizen -Qi'
  131. alias trlocs='trizen -Qs'
  132. alias trlst='trizen -Qe'
  133. alias trorph='trizen -Qtd'
  134. alias trinsd='trizen -S --asdeps'
  135. alias trmir='trizen -Syy'
  136. alias trupd="trizen -Sy"
  137. alias upgrade='trizen -Syu'
  138. fi
  139. if (( $+commands[yaourt] )); then
  140. alias yaconf='yaourt -C'
  141. alias yaupg='yaourt -Syua'
  142. alias yasu='yaourt -Syua --noconfirm'
  143. alias yain='yaourt -S'
  144. alias yains='yaourt -U'
  145. alias yare='yaourt -R'
  146. alias yarem='yaourt -Rns'
  147. alias yarep='yaourt -Si'
  148. alias yareps='yaourt -Ss'
  149. alias yaloc='yaourt -Qi'
  150. alias yalocs='yaourt -Qs'
  151. alias yalst='yaourt -Qe'
  152. alias yaorph='yaourt -Qtd'
  153. alias yainsd='yaourt -S --asdeps'
  154. alias yamir='yaourt -Syy'
  155. alias yaupd="yaourt -Sy"
  156. alias upgrade='yaourt -Syu'
  157. fi
  158. if (( $+commands[yay] )); then
  159. alias yaconf='yay -Pg'
  160. alias yaupg='yay -Syu'
  161. alias yasu='yay -Syu --noconfirm'
  162. alias yain='yay -S'
  163. alias yains='yay -U'
  164. alias yare='yay -R'
  165. alias yarem='yay -Rns'
  166. alias yarep='yay -Si'
  167. alias yareps='yay -Ss'
  168. alias yaloc='yay -Qi'
  169. alias yalocs='yay -Qs'
  170. alias yalst='yay -Qe'
  171. alias yaorph='yay -Qtd'
  172. alias yainsd='yay -S --asdeps'
  173. alias yamir='yay -Syy'
  174. alias yaupd="yay -Sy"
  175. alias upgrade='yay -Syu'
  176. fi