config/shell: use fzf for locate results

This commit is contained in:
xeruf 2021-10-15 14:31:08 +02:00
parent dddbb9fcab
commit ad78e5fb6f
2 changed files with 18 additions and 16 deletions

View File

@ -24,10 +24,7 @@ cl() {
ls --almost-all --group-directories-first --file-type
}
mkcd() {
mkdir -p "$1" && cd "$1"
}
# cd but search for data dirs and ls in new dir
cd() {
if test -d "$DATA" && test "$1" != "-" -a ! -d "$1" -a $# -eq 1
then
@ -39,6 +36,16 @@ cd() {
fi
}
# LOCATE
loci() { locate --all --ignore-case --basename --existing "$@" | command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | fzf --reverse --height=30% }
alias loc='noglob loci'
alias uloc='noglob sudo updatedb && loci'
# locate exactly
locei() { locate --all --basename "\\$1" "$@" | fzf --reverse --height=30% }
alias loce='noglob locei'
# locate all
alias loca='noglob sudo updatedb --prunenames "" /var/lib/mlocate/all.db && loci --database ""'
# ZOXIDE
alias c=z
d() {

View File

@ -110,8 +110,8 @@ alias syslog='less +F /var/log/syslog'
alias sc='sudo systemctl'
alias sce='sudo systemctl enable --now'
scs() {
systemctl --user status "$1" "*$1*" ||
sudo systemctl status "$1" "*$1*"
systemctl --user status "*$1*" ||
sudo systemctl status "*$1*"
}
alias scu='systemctl --user'
alias scue='systemctl --user enable --now'
@ -145,16 +145,6 @@ blues() { bluedevil-sendfile $(echo "$@" | xargs -n 1 realpath | xargs -n 1 echo
alias delta="sc restart openvpn-client@deltaPeak.service"
alias sshl="lemonade server -allow 127.0.0.1 & ssh -R 2489:127.0.0.1:2489"
# locate roughly
loci() { locate --all --ignore-case --basename --existing "$@" | command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | less -F }
alias loc='noglob loci'
alias uloc='noglob sudo updatedb && loci'
# locate exactly
locei() { locate --all --basename "\\$1" "$@" | less -F }
alias loce='noglob locei'
# locate all
alias loca='noglob sudo updatedb --prunenames "" /var/lib/mlocate/all.db && loci --database ""'
# Listen to loopback of mic
alias listen='pactl load-module module-loopback; echo "Press Enter to stop"; read; pactl unload-module module-loopback'
@ -292,6 +282,11 @@ mvln() {
ln -vsr "$2" "$1"
}
# Create directory and move into it
mkcd() {
mkdir -p "$1" && cd "$1"
}
# Other stuff {{{1
resetdocker() {