diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-07 18:59:08 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-07 18:59:08 +0200 |
commit | cb110575144beb4125fd1d8204c8204e6bca280f (patch) | |
tree | 980a73128d24b6a5d5901db8d2835168fac1b2b0 | |
parent | c849427d901c54531aa070ec25273e938e771c77 (diff) |
[goo] added option to give search query as second paramater
I noticed by mistake sometimes I would type the query already.
-rwxr-xr-x | bin/common/goo | 9 | ||||
-rw-r--r-- | config/essentials/zsh/functions.zsh | 6 |
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/common/goo b/bin/common/goo index cfd03ec..2a5faad 100755 --- a/bin/common/goo +++ b/bin/common/goo @@ -15,9 +15,14 @@ VisualParadigm intellij arduino15" +if [ -n "$2" ] +then + [ -d "$2" ] && dest="$2" || opt="-q $2" +fi + for dir in $exclude; do dirs="$dirs -name \"$dir\" -o " done -cmd="find ${2:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" +cmd="find ${dest:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -mindepth 1 -print" -eval "$cmd" 2>/dev/null +eval "$cmd" 2>/dev/null | fzf $opt diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 671e6fb..053ce8e 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -39,9 +39,9 @@ nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } # googoo aliases -ff () { goo f "$1" | fzf } -fd () { goo d "$1" | fzf } -fdf () { goo f "$1" | fzf | xargs -I {} dirname "{}" } +ff () { goo f "$1" } +fd () { goo d "$1" } +fdf () { goo f "$1" | xargs -I {} dirname "{}" } o () { f="$(ff $1)" |