summaryrefslogtreecommitdiffstats
path: root/zsh/oh-my-zsh/plugins/archlinux
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/oh-my-zsh/plugins/archlinux')
-rw-r--r--zsh/oh-my-zsh/plugins/archlinux/README.md183
-rw-r--r--zsh/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh184
2 files changed, 367 insertions, 0 deletions
diff --git a/zsh/oh-my-zsh/plugins/archlinux/README.md b/zsh/oh-my-zsh/plugins/archlinux/README.md
new file mode 100644
index 0000000..fd772c6
--- /dev/null
+++ b/zsh/oh-my-zsh/plugins/archlinux/README.md
@@ -0,0 +1,183 @@
+# Arch Linux plugin
+
+This plugin adds some aliases and functions to work with Arch Linux.
+
+To use it, add `archlinux` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... archlinux)
+```
+
+## Features
+
+### Pacman
+
+| Alias | Command | Description |
+|--------------|----------------------------------------|------------------------------------------------------------------|
+| pacin | `sudo pacman -S` | Install packages from the repositories |
+| pacins | `sudo pacman -U` | Install a package from a local file |
+| pacinsd | `sudo pacman -S --asdeps` | Install packages as dependencies of another package |
+| paclean | `sudo pacman -Sc` | Clean out old and unused caches and packages |
+| pacloc | `pacman -Qi` | Display information about a package in the local database |
+| paclocs | `pacman -Qs` | Search for packages in the local database |
+| paclr | `sudo pacman -Scc` | Remove all files from the cache |
+| paclsorphans | `sudo pacman -Qdt` | List all orphaned packages |
+| pacmir | `sudo pacman -Syy` | Force refresh of all package lists after updating mirrorlist |
+| pacre | `sudo pacman -R` | Remove packages, keeping its settings and dependencies |
+| pacrem | `sudo pacman -Rns` | Remove packages, including its settings and dependencies |
+| pacrep | `pacman -Si` | Display information about a package in the repositories |
+| pacreps | `pacman -Ss` | Search for packages in the repositories |
+| pacrmorphans | `sudo pacman -Rs $(pacman -Qtdq)` | Delete all orphaned packages |
+| pacupd | `sudo pacman -Sy` | Update and refresh local package, ABS and AUR databases |
+| pacupg | `sudo pacman -Syu` | Sync with repositories before upgrading packages |
+| pacfileupg | `sudo pacman -Fy` | Download fresh package databases from the server |
+| pacfiles | `pacman -F` | Search package file names for matching strings |
+| pacls | `pacman -Ql` | List files in a package |
+| pacown | `pacman -Qo` | Show which package owns a file |
+| upgrade[¹](#f1) | `sudo pacman -Syu` | Sync with repositories before upgrading packages |
+
+| Function | Description |
+|----------------|-----------------------------------------------------------|
+| pacdisowned | List all disowned files in your system |
+| paclist | List all explicitly installed packages with a description |
+| pacmanallkeys | Get all keys for developers and trusted users |
+| pacmansignkeys | Locally trust all keys passed as parameters |
+| pacweb | Open the website of an ArchLinux package |
+
+Note: paclist used to print packages with a description which are (1) explicitly installed
+and (2) available for upgrade. Due to flawed scripting, it also printed all packages if no
+upgrades were available. Use `pacman -Que` instead.
+
+### AUR helpers
+
+#### Aura
+
+| Alias | Command | Description |
+|---------|-------------------------------------------------|-------------------------------------------------------------------------|
+| auclean | `sudo aura -Sc` | Clean out old and unused caches and packages |
+| auclr | `sudo aura -Scc` | Remove all files from the cache |
+| auin | `sudo aura -S` | Install packages from the repositories |
+| aurin | `sudo aura -A` | Install packages from the repositories |
+| auins | `sudo aura -U` | Install a package from a local file |
+| auinsd | `sudo aura -S --asdeps` | Install packages as dependencies of another package (repositories only) |
+| aurinsd | `sudo aura -A --asdeps` | Install packages as dependencies of another package (AUR only) |
+| auloc | `aura -Qi` | Display information about a package in the local database |
+| aulocs | `aura -Qs` | Search for packages in the local database |
+| auls | `aura -Qql` | List all files owned by a given package |
+| aulst | `aura -Qe` | List installed packages including from AUR (tagged as "local") |
+| aumir | `sudo aura -Syy` | Force refresh of all package lists after updating mirrorlist |
+| aurph | `sudo aura -Oj` | Remove orphans using aura |
+| auown | `aura -Qqo` | Search for packages that own the specified file(s) |
+| aure | `sudo aura -R` | Remove packages, keeping its settings and dependencies |
+| aurem | `sudo aura -Rns` | Remove packages, including its settings and unneeded dependencies |
+| aurep | `aura -Si` | Display information about a package in the repositories |
+| aurrep | `aura -Ai` | Display information about a package from AUR |
+| aureps | `aura -As --both` | Search for packages in the repositories and AUR |
+| auras | `aura -As --both` | Same as above |
+| auupd | `sudo aura -Sy` | Update and refresh local package, ABS and AUR databases |
+| auupg | `sudo sh -c "aura -Syu && aura -Au"` | Sync with repositories before upgrading all packages (from AUR too) |
+| ausu | `sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"` | Same as `auupg`, but without confirmation |
+| upgrade[¹](#f1) | `sudo aura -Syu` | Sync with repositories before upgrading packages |
+
+| Function | Description |
+|-----------------|---------------------------------------------------------------------|
+| auownloc _file_ | Display information about a package that owns the specified file(s) |
+| auownls _file_ | List all files owned by a package that owns the specified file(s) |
+
+#### Pacaur
+
+| Alias | Command | Description |
+|---------|-----------------------------------|---------------------------------------------------------------------|
+| pacclean| `pacaur -Sc` | Clean out old and unused caches and packages |
+| pacclr | `pacaur -Scc` | Remove all files from the cache |
+| pain | `pacaur -S` | Install packages from the repositories |
+| pains | `pacaur -U` | Install a package from a local file |
+| painsd | `pacaur -S --asdeps` | Install packages as dependencies of another package |
+| paloc | `pacaur -Qi` | Display information about a package in the local database |
+| palocs | `pacaur -Qs` | Search for packages in the local database |
+| palst | `pacaur -Qe` | List installed packages including from AUR (tagged as "local") |
+| pamir | `pacaur -Syy` | Force refresh of all package lists after updating mirrorlist |
+| paorph | `pacaur -Qtd` | Remove orphans using pacaur |
+| pare | `pacaur -R` | Remove packages, keeping its settings and dependencies |
+| parem | `pacaur -Rns` | Remove packages, including its settings and unneeded dependencies |
+| parep | `pacaur -Si` | Display information about a package in the repositories |
+| pareps | `pacaur -Ss` | Search for packages in the repositories |
+| paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases |
+| paupg | `pacaur -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
+| pasu | `pacaur -Syua --no-confirm` | Same as `paupg`, but without confirmation |
+| upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages |
+
+#### Trizen
+
+| Alias | Command | Description |
+|---------|-----------------------------------|---------------------------------------------------------------------|
+| trconf | `trizen -C` | Fix all configuration files with vimdiff |
+| trclean | `trizen -Sc` | Clean out old and unused caches and packages |
+| trclr | `trizen -Scc` | Remove all files from the cache |
+| trin | `trizen -S` | Install packages from the repositories |
+| trins | `trizen -U` | Install a package from a local file |
+| trinsd | `trizen -S --asdeps` | Install packages as dependencies of another package |
+| trloc | `trizen -Qi` | Display information about a package in the local database |
+| trlocs | `trizen -Qs` | Search for packages in the local database |
+| trlst | `trizen -Qe` | List installed packages including from AUR (tagged as "local") |
+| trmir | `trizen -Syy` | Force refresh of all package lists after updating mirrorlist |
+| trorph | `trizen -Qtd` | Remove orphans using yaourt |
+| trre | `trizen -R` | Remove packages, keeping its settings and dependencies |
+| trrem | `trizen -Rns` | Remove packages, including its settings and unneeded dependencies |
+| trrep | `trizen -Si` | Display information about a package in the repositories |
+| trreps | `trizen -Ss` | Search for packages in the repositories |
+| trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases |
+| trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
+| trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation |
+| upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages |
+
+#### Yay
+
+| Alias | Command | Description |
+|---------|--------------------------------|-------------------------------------------------------------------|
+| yaconf | `yay -Pg` | Print current configuration |
+| yaclean | `yay -Sc` | Clean out old and unused caches and packages |
+| yaclr | `yay -Scc` | Remove all files from the cache |
+| yain | `yay -S` | Install packages from the repositories |
+| yains | `yay -U` | Install a package from a local file |
+| yainsd | `yay -S --asdeps` | Install packages as dependencies of another package |
+| yaloc | `yay -Qi` | Display information about a package in the local database |
+| yalocs | `yay -Qs` | Search for packages in the local database |
+| yalst | `yay -Qe` | List installed packages including from AUR (tagged as "local") |
+| yamir | `yay -Syy` | Force refresh of all package lists after updating mirrorlist |
+| yaorph | `yay -Qtd` | Remove orphans using yay |
+| yare | `yay -R` | Remove packages, keeping its settings and dependencies |
+| yarem | `yay -Rns` | Remove packages, including its settings and unneeded dependencies |
+| yarep | `yay -Si` | Display information about a package in the repositories |
+| yareps | `yay -Ss` | Search for packages in the repositories |
+| yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases |
+| yaupg | `yay -Syu` | Sync with repositories before upgrading packages |
+| yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation |
+| upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages |
+
+---
+
+<span id="f1">¹</span>
+The `upgrade` alias is set for all package managers. Its value will depend on
+whether the package manager is installed, checked in the following order:
+
+1. `yay`
+2. `trizen`
+3. `pacaur`
+4. `aura`
+5. `pacman`
+
+## Contributors
+
+- Benjamin Boudreau - dreurmail@gmail.com
+- Celso Miranda - contacto@celsomiranda.net
+- ratijas (ivan tkachenko) - me@ratijas.tk
+- Juraj Fiala - doctorjellyface@riseup.net
+- KhasMek - Boushh@gmail.com
+- Majora320 (Moses Miller) - Majora320@gmail.com
+- Martin Putniorz - mputniorz@gmail.com
+- MatthR3D - matthr3d@gmail.com
+- ornicar - thibault.duplessis@gmail.com
+- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
+- Jeff M. Hubbard - jeffmhubbard@gmail.com
+- K. Harishankar(harishnkr) - hari2menon1234@gmail.com
diff --git a/zsh/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh b/zsh/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
new file mode 100644
index 0000000..4f13647
--- /dev/null
+++ b/zsh/oh-my-zsh/plugins/archlinux/archlinux.plugin.zsh
@@ -0,0 +1,184 @@
+#######################################
+# Pacman #
+#######################################
+
+# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
+alias pacupg='sudo pacman -Syu'
+alias pacin='sudo pacman -S'
+alias paclean='sudo pacman -Sc'
+alias pacins='sudo pacman -U'
+alias paclr='sudo pacman -Scc'
+alias pacre='sudo pacman -R'
+alias pacrem='sudo pacman -Rns'
+alias pacrep='pacman -Si'
+alias pacreps='pacman -Ss'
+alias pacloc='pacman -Qi'
+alias paclocs='pacman -Qs'
+alias pacinsd='sudo pacman -S --asdeps'
+alias pacmir='sudo pacman -Syy'
+alias paclsorphans='sudo pacman -Qdt'
+alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
+alias pacfileupg='sudo pacman -Fy'
+alias pacfiles='pacman -F'
+alias pacls='pacman -Ql'
+alias pacown='pacman -Qo'
+alias pacupd="sudo pacman -Sy"
+alias upgrade='sudo pacman -Syu'
+
+function paclist() {
+ # Based on https://bbs.archlinux.org/viewtopic.php?id=93683
+ pacman -Qqe | \
+ xargs -I '{}' \
+ expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}'
+}
+
+function pacdisowned() {
+ local tmp db fs
+ tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
+ db=$tmp/db
+ fs=$tmp/fs
+
+ mkdir "$tmp"
+ trap 'rm -rf "$tmp"' EXIT
+
+ pacman -Qlq | sort -u > "$db"
+
+ find /bin /etc /lib /sbin /usr ! -name lost+found \
+ \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
+
+ comm -23 "$fs" "$db"
+}
+
+alias pacmanallkeys='sudo pacman-key --refresh-keys'
+
+function pacmansignkeys() {
+ local key
+ for key in $@; do
+ sudo pacman-key --recv-keys $key
+ sudo pacman-key --lsign-key $key
+ printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
+ --no-permission-warning --command-fd 0 --edit-key $key
+ done
+}
+
+if (( $+commands[xdg-open] )); then
+ function pacweb() {
+ if [[ $# = 0 || "$1" =~ '--help|-h' ]]; then
+ local underline_color="\e[${color[underline]}m"
+ echo "$0 - open the website of an ArchLinux package"
+ echo
+ echo "Usage:"
+ echo " $bold_color$0$reset_color ${underline_color}target${reset_color}"
+ return 1
+ fi
+
+ local pkg="$1"
+ local infos="$(LANG=C pacman -Si "$pkg")"
+ if [[ -z "$infos" ]]; then
+ return
+ fi
+ local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
+ local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
+ xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
+ }
+fi
+
+#######################################
+# AUR helpers #
+#######################################
+
+if (( $+commands[aura] )); then
+ alias auin='sudo aura -S'
+ alias aurin='sudo aura -A'
+ alias auclean='sudo aura -Sc'
+ alias auclr='sudo aura -Scc'
+ alias auins='sudo aura -U'
+ alias auinsd='sudo aura -S --asdeps'
+ alias aurinsd='sudo aura -A --asdeps'
+ alias auloc='aura -Qi'
+ alias aulocs='aura -Qs'
+ alias aulst='aura -Qe'
+ alias aumir='sudo aura -Syy'
+ alias aurph='sudo aura -Oj'
+ alias aure='sudo aura -R'
+ alias aurem='sudo aura -Rns'
+ alias aurep='aura -Si'
+ alias aurrep='aura -Ai'
+ alias aureps='aura -As --both'
+ alias auras='aura -As --both'
+ alias auupd="sudo aura -Sy"
+ alias auupg='sudo sh -c "aura -Syu && aura -Au"'
+ alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
+ alias upgrade='sudo aura -Syu'
+
+ # extra bonus specially for aura
+ alias auown="aura -Qqo"
+ alias auls="aura -Qql"
+ function auownloc() { aura -Qi $(aura -Qqo $@); }
+ function auownls () { aura -Qql $(aura -Qqo $@); }
+fi
+
+if (( $+commands[pacaur] )); then
+ alias pacclean='pacaur -Sc'
+ alias pacclr='pacaur -Scc'
+ alias paupg='pacaur -Syu'
+ alias pasu='pacaur -Syu --noconfirm'
+ alias pain='pacaur -S'
+ alias pains='pacaur -U'
+ alias pare='pacaur -R'
+ alias parem='pacaur -Rns'
+ alias parep='pacaur -Si'
+ alias pareps='pacaur -Ss'
+ alias paloc='pacaur -Qi'
+ alias palocs='pacaur -Qs'
+ alias palst='pacaur -Qe'
+ alias paorph='pacaur -Qtd'
+ alias painsd='pacaur -S --asdeps'
+ alias pamir='pacaur -Syy'
+ alias paupd="pacaur -Sy"
+ alias upgrade='pacaur -Syu'
+fi
+
+if (( $+commands[trizen] )); then
+ alias trconf='trizen -C'
+ alias trupg='trizen -Syua'
+ alias trsu='trizen -Syua --noconfirm'
+ alias trin='trizen -S'
+ alias trclean='trizen -Sc'
+ alias trclr='trizen -Scc'
+ alias trins='trizen -U'
+ alias trre='trizen -R'
+ alias trrem='trizen -Rns'
+ alias trrep='trizen -Si'
+ alias trreps='trizen -Ss'
+ alias trloc='trizen -Qi'
+ alias trlocs='trizen -Qs'
+ alias trlst='trizen -Qe'
+ alias trorph='trizen -Qtd'
+ alias trinsd='trizen -S --asdeps'
+ alias trmir='trizen -Syy'
+ alias trupd="trizen -Sy"
+ alias upgrade='trizen -Syu'
+fi
+
+if (( $+commands[yay] )); then
+ alias yaconf='yay -Pg'
+ alias yaclean='yay -Sc'
+ alias yaclr='yay -Scc'
+ alias yaupg='yay -Syu'
+ alias yasu='yay -Syu --noconfirm'
+ alias yain='yay -S'
+ alias yains='yay -U'
+ alias yare='yay -R'
+ alias yarem='yay -Rns'
+ alias yarep='yay -Si'
+ alias yareps='yay -Ss'
+ alias yaloc='yay -Qi'
+ alias yalocs='yay -Qs'
+ alias yalst='yay -Qe'
+ alias yaorph='yay -Qtd'
+ alias yainsd='yay -S --asdeps'
+ alias yamir='yay -Syy'
+ alias yaupd="yay -Sy"
+ alias upgrade='yay -Syu'
+fi