summaryrefslogtreecommitdiff
path: root/config/essentials/zsh/functions.zsh
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-14 11:50:41 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-14 11:50:41 +0200
commit67a2df82d25f52ea0937f4eed355546deae7b4b5 (patch)
tree40bc358a6d2a6b119e04229b48fd05dd74a5b81d /config/essentials/zsh/functions.zsh
parent4fbb921cd8a9da0135e0ddf54da898e080cc8c7e (diff)
parentb0ef0738b3f0cebde9ed6b1d40ca0f7cbb1385a3 (diff)
Merge branch 'main' of /var/git/dotfiles
Diffstat (limited to 'config/essentials/zsh/functions.zsh')
-rw-r--r--config/essentials/zsh/functions.zsh29
1 files changed, 21 insertions, 8 deletions
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh
index 671e6fb..3c5f11f 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" | fzf }
-fd () { goo d "$1" | fzf }
-fdf () { goo f "$1" | fzf | 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"
}
@@ -69,7 +76,13 @@ ipc ()
fi
}
-calc () { echo "$@" | bc -l }
+calc () { echo "$@" | bc -l | numfmt --grouping; }
+
+psgrep ()
+{
+ [ $# -eq 0 ] && return 1
+ pgrep "$@" | xargs ps
+}
unique () {
local f