diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-13 20:15:52 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-08-13 20:15:52 +0200 |
commit | b3f42fec8739d1d23ec6d64ff35c9db022c5adca (patch) | |
tree | 45d7b30092cde99c0b962c9f89571089b60209d3 /config/essentials | |
parent | 818dabae65e67cb52f11623ab1e76ad4c85c19e1 (diff) |
[googoo] removed functions and updated behaviour
removed functions that where unneed as they were only called once,
changed behaviour to not implement fzf in goo but in the functions
itself, this makes goo easier to implement in other commands. Also
ported over the funcitonality of setting the query with the first
argument
Diffstat (limited to 'config/essentials')
-rw-r--r-- | config/essentials/zsh/functions.zsh | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 053ce8e..c4999db 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -39,23 +39,30 @@ nnn() { test -z "$NNNLVL" && /usr/bin/nnn "$@" || exit } ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit } # googoo aliases -ff () { goo f "$1" } -fd () { goo d "$1" } -fdf () { goo f "$1" | xargs -I {} dirname "{}" } +_googoo_fzf_opt () +{ + if [ "$1" ] + then + [ -d "$1" ] && dest="$1" || opt="-q $1" + fi +} o () { - f="$(ff $1)" + _googoo_fzf_opt "$1" + f="$(goo f "dest" | fzf $opt)" test "$1" && shift - test -n "$f" && $EDITOR $@ "$f" + test -f "$f" && $EDITOR $@ "$f" } go () { - d="$(fd $1)" + _googoo_fzf_opt "$1" + d="$(goo d "$dest" | fzf $opt)" test -d "$d" && cd "$d" } ogo () { - d="$(fdf $1)" + _googoo_fzf_opt "$1" + d="$(dirname "$(goo f "$dest")" | fzf $opt)" test -d "$d" && cd "$d" } |