update search shell function to search current directory by default

instead of searching ~/doc, search the current directory. the old
functionality can be restored by passing -a to the function.
This commit is contained in:
stupidcomputer 2024-04-08 08:42:36 -05:00
parent ab145f8294
commit 5f32ddeb26
1 changed files with 21 additions and 10 deletions

View File

@ -25,6 +25,7 @@ hist() {
}
search() {
if [ "$1" = '-a' ]; then
res=$(find /home/usr/ /home/usr/doc/ \
-mindepth 1 \
-not -path '*/.*' \
@ -34,6 +35,16 @@ search() {
-not -path '*node_modules*' \
-not -path '*__pycache__*' \
-type d | cut -c 11- | fzy)
else
res=$(find $(pwd) \
-mindepth 1 \
-not -path '*/.*' \
-not -path './Mail/*' \
-not -path './vdir/*' \
-not -path '*venv*' \
-not -path '*node_modules*' \
-not -path '*__pycache__*' \
-type d | cut -c 11- | fzy)
fi
[ -n "$res" ] && cd /home/usr/"$res"
}