config/shell/browse: select locate result with fzf

This commit is contained in:
xeruf 2021-10-17 13:41:29 +02:00
parent b64646913d
commit 14f4d4c9b2
3 changed files with 4 additions and 1779 deletions

File diff suppressed because it is too large Load Diff

View File

@ -37,11 +37,12 @@ cd() {
} }
# LOCATE # 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 fselect='fzf -0 -1 --reverse --height=30%'
loci() { locate --all --ignore-case --basename --existing "$@" | command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | fselect }
alias loc='noglob loci' alias loc='noglob loci'
alias uloc='noglob sudo updatedb && loci' alias uloc='noglob sudo updatedb && loci'
# locate exactly # locate exactly
locei() { locate --all --basename "\\$1" "$@" | fzf --reverse --height=30% } locei() { locate --all --basename "\\$1" "$@" | fselect }
alias loce='noglob locei' alias loce='noglob locei'
# locate all # locate all
alias loca='noglob sudo updatedb --prunenames "" /var/lib/mlocate/all.db && loci --database ""' alias loca='noglob sudo updatedb --prunenames "" /var/lib/mlocate/all.db && loci --database ""'

View File

@ -18,7 +18,7 @@ then shift
if file "$path" | grep -i ' playlist' || expr "$path" : ".*\.m3u8\?$" >/dev/null if file "$path" | grep -i ' playlist' || expr "$path" : ".*\.m3u8\?$" >/dev/null
then pushd "$(dirname "$path")" >/dev/null && cat "$path" | xargs --delim='\n' "$0" $verbose -r && popd >/dev/null then pushd "$(dirname "$path")" >/dev/null && cat "$path" | xargs --delim='\n' "$0" $verbose -r && popd >/dev/null
else else
find "$path" -name "*.flac" -o -name "*.mp3" | while read file find "$path" -name "*.flac" -o -name "*.mp3" | sort | while read file
do case "$path" in do case "$path" in
($MUSIC/*) echo "${file#$MUSIC/}";; ($MUSIC/*) echo "${file#$MUSIC/}";;
(*) mkdir -p "$LINKS" && ln -fs "$file" "$LINKS/$(basename "$file")" && echo "${LINKS#$MUSIC/}/$(basename "$file")";; (*) mkdir -p "$LINKS" && ln -fs "$file" "$LINKS/$(basename "$file")" && echo "${LINKS#$MUSIC/}/$(basename "$file")";;