config/shell: make some aliases safer & add yay functions
This commit is contained in:
parent
dda50a70cc
commit
a5063e47e9
|
@ -1,13 +1,23 @@
|
||||||
which pacman >/dev/null || return 0
|
which pacman >/dev/null || return 0
|
||||||
|
|
||||||
# Arch aliases
|
# Arch aliases
|
||||||
alias pac='sudo pacman'
|
alias pac='noglob sudo pacman'
|
||||||
alias pacs='pac -Syu --needed'
|
alias pacs='pac -Syu --needed'
|
||||||
alias pacr='pac -R'
|
alias pacr='pac -R'
|
||||||
alias yays='yay -S --needed'
|
alias yays='noglob yay -S --needed'
|
||||||
alias yayr='yay -R'
|
alias yayr='noglob yay -R'
|
||||||
|
|
||||||
|
yzf() {
|
||||||
|
query=$(test "$1" = "Q" && echo " -l")
|
||||||
|
pos=$(test "$query" && echo 1 || echo 2)
|
||||||
|
yay --color always -$1$2 | sed "s/ /\t/g" | fzf --history=/var/tmp/fzf-history-yay --preview "echo {} | cut -f$pos | xargs yay --color always -$1 -i $query" | cut -f$pos
|
||||||
|
}
|
||||||
yas() {
|
yas() {
|
||||||
pkg=$(yay -Pc | cut -d' ' -f1 | fzf --preview 'yay -Si {}')
|
pkg=$(yzf S l)
|
||||||
test "$pkg" && echo "Install $pkg..." && yay -S "$pkg"
|
test "$pkg" && echo "Install $pkg..." && yay -S "$pkg"
|
||||||
}
|
}
|
||||||
|
yar() {
|
||||||
|
pkg=$(yzf Q)
|
||||||
|
test "$pkg" && echo "Removing $pkg..." && yay -R "$pkg"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,11 +84,12 @@ t() {
|
||||||
|
|
||||||
alias tw='timew'
|
alias tw='timew'
|
||||||
twsm() { timew summary $(date --date="Monday $1 week ago" -I) to tomorrow :ids ${@:2} }
|
twsm() { timew summary $(date --date="Monday $1 week ago" -I) to tomorrow :ids ${@:2} }
|
||||||
alias twtest='( TIMEWARRIORDB=/tmp/timewarriordb && rm -rf ${TIMEWARRIORDB} && mkdir -p ${TIMEWARRIORDB}/data && :> ${TIMEWARRIORDB}/timewarrior.cfg && $SHELL )'
|
alias twtest='( TIMEWARRIORDB=/tmp/timewarriordb && mv ${TIMEWARRIORDB} /tmp/twdb && mkdir -p ${TIMEWARRIORDB}/data && :> ${TIMEWARRIORDB}/timewarrior.cfg && $SHELL )'
|
||||||
|
|
||||||
# Quick shortcuts
|
# Quick shortcuts
|
||||||
alias c='clear'
|
alias c='clear'
|
||||||
alias v='editright'
|
alias v='editright'
|
||||||
|
alias rm='rm -d'
|
||||||
|
|
||||||
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
||||||
alias lar='last | tac'
|
alias lar='last | tac'
|
||||||
|
@ -121,7 +122,9 @@ rpl() {
|
||||||
|
|
||||||
# Recover stray swap files from neovim
|
# Recover stray swap files from neovim
|
||||||
alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs -r nvim"
|
alias vrec="ls $XDG_DATA_HOME/nvim/swap | sed 's/\%/\//g' | sed 's|\(.*\)\..*|\1|' | head -1 | xargs -r nvim"
|
||||||
alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r rm"
|
alias vrecd="ls $XDG_DATA_HOME/nvim/swap | head -1 | xargs -r -i mv {} /tmp"
|
||||||
|
|
||||||
|
unv() { strings $1 | sed 's/5$//' | dedup }
|
||||||
|
|
||||||
# Applications
|
# Applications
|
||||||
alias dict="(builtin cd $XDG_DATA_HOME/dictcc && rlwrap perl dictcc-helper.pl)"
|
alias dict="(builtin cd $XDG_DATA_HOME/dictcc && rlwrap perl dictcc-helper.pl)"
|
||||||
|
|
Loading…
Reference in New Issue