summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/common/fhome21
-rwxr-xr-xbin/common/fzfdir2
-rwxr-xr-xbin/common/fzfdirfile2
-rwxr-xr-xbin/common/fzffile2
-rw-r--r--config/essentials/zsh/functions.zsh8
5 files changed, 28 insertions, 7 deletions
diff --git a/bin/common/fhome b/bin/common/fhome
new file mode 100755
index 0000000..cba1beb
--- /dev/null
+++ b/bin/common/fhome
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+exclude="
+.cache
+.mozilla
+.npm
+.git
+site-packages
+objects
+instances
+discord
+Steam
+?eclipse
+arduino15"
+
+for dir in $exclude; do
+ dirs="$dirs -name \"$dir\" -o "
+done
+cmd="find ${2:-$HOME} \(${dirs} -false \) -prune -o -type ${1:-f} -print"
+
+eval "$cmd" 2>/dev/null
diff --git a/bin/common/fzfdir b/bin/common/fzfdir
index 6ae8f6a..fdbe79c 100755
--- a/bin/common/fzfdir
+++ b/bin/common/fzfdir
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
-find "${1:-$HOME}" -type \d 2> /dev/null | fzf
+fzhome d | fzf
diff --git a/bin/common/fzfdirfile b/bin/common/fzfdirfile
index df0e51a..18110ea 100755
--- a/bin/common/fzfdirfile
+++ b/bin/common/fzfdirfile
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
-dirname "$(find "${1:-$HOME}" -type f 2> /dev/null | fzf)"
+dirname "$(fzhome | fzf)"
diff --git a/bin/common/fzffile b/bin/common/fzffile
index 03e39be..e2f9f76 100755
--- a/bin/common/fzffile
+++ b/bin/common/fzffile
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
-find "${1:-$HOME}" -type f 2> /dev/null | fzf
+fzhome | fzf
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh
index 4833576..637df07 100644
--- a/config/essentials/zsh/functions.zsh
+++ b/config/essentials/zsh/functions.zsh
@@ -13,18 +13,18 @@ ranger() { test -z "$RANGER_LEVEL" && /usr/bin/ranger "$@" || exit }
# googoo
o ()
{
- f="$(fzffile $1)"
- test "$#" -gt 0 && shift
+ f="$(fhome f ${1:-$HOME} | fzf)"
+ test "$1" && shift
test -n "$f" && $EDITOR $@ "$f"
}
go ()
{
- d="$(fzfdir $1)"
+ d="$(fhome d ${1:-$HOME} | fzf)"
test -d "$d" && cd "$d"
}
ogo ()
{
- d="$(fzfdirfile $1)"
+ d="$(fhome f ${1:-$HOME} | fzf | xargs dirname)"
test -d "$d" && cd "$d"
}