]> git.rmz.io Git - dotfiles.git/blob - zsh/plugins/archlinux/archlinux.plugin.zsh
add my own theme
[dotfiles.git] / zsh / plugins / archlinux / archlinux.plugin.zsh
1 # Archlinux zsh aliases and functions
2 # Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
3
4 # Look for yaourt, and add some useful functions if we have it.
5 if [[ -x `which yaourt` ]]; then
6 upgrade () {
7 yaourt -Syu
8 }
9 alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
10 # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
11 alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
12 alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
13 alias yain='yaourt -S' # Install specific package(s) from the repositories
14 alias yains='yaourt -U' # Install specific package not from the repositories but from a file
15 alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
16 alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
17 alias yarep='yaourt -Si' # Display information about a given package in the repositories
18 alias yareps='yaourt -Ss' # Search for package(s) in the repositories
19 alias yaloc='yaourt -Qi' # Display information about a given package in the local database
20 alias yalocs='yaourt -Qs' # Search for package(s) in the local database
21 # Additional yaourt alias examples
22 if [[ -x `which abs` ]]; then
23 alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
24 else
25 alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories
26 fi
27 alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
28 alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
29 else
30 upgrade() {
31 sudo pacman -Syu
32 }
33 fi
34
35 # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
36 alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
37 alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
38 alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
39 alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
40 alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
41 alias pacrep='pacman -Si' # Display information about a given package in the repositories
42 alias pacreps='pacman -Ss' # Search for package(s) in the repositories
43 alias pacloc='pacman -Qi' # Display information about a given package in the local database
44 alias paclocs='pacman -Qs' # Search for package(s) in the local database
45 # Additional pacman alias examples
46 if [[ -x `which abs` ]]; then
47 alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
48 else
49 alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories
50 fi
51 alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
52 alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
53
54 # https://bbs.archlinux.org/viewtopic.php?id=93683
55 paclist() {
56 sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
57 }
58
59 alias paclsorphans='sudo pacman -Qdt'
60 alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
61
62 pacdisowned() {
63 tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
64 db=$tmp/db
65 fs=$tmp/fs
66
67 mkdir "$tmp"
68 trap 'rm -rf "$tmp"' EXIT
69
70 pacman -Qlq | sort -u > "$db"
71
72 find /bin /etc /lib /sbin /usr \
73 ! -name lost+found \
74 \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
75
76 comm -23 "$fs" "$db"
77 }
78
79 pacmanallkeys() {
80 # Get all keys for developers and trusted users
81 curl https://www.archlinux.org/{developers,trustedusers}/ |
82 awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
83 xargs sudo pacman-key --recv-keys
84 }
85
86 pacmansignkeys() {
87 for key in $*; do
88 sudo pacman-key --recv-keys $key
89 sudo pacman-key --lsign-key $key
90 printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
91 --no-permission-warning --command-fd 0 --edit-key $key
92 done
93 }