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:
parent
ab145f8294
commit
5f32ddeb26
|
@ -25,15 +25,26 @@ hist() {
|
||||||
}
|
}
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
res=$(find /home/usr/ /home/usr/doc/ \
|
if [ "$1" = '-a' ]; then
|
||||||
-mindepth 1 \
|
res=$(find /home/usr/ /home/usr/doc/ \
|
||||||
-not -path '*/.*' \
|
-mindepth 1 \
|
||||||
-not -path './Mail/*' \
|
-not -path '*/.*' \
|
||||||
-not -path './vdir/*' \
|
-not -path './Mail/*' \
|
||||||
-not -path '*venv*' \
|
-not -path './vdir/*' \
|
||||||
-not -path '*node_modules*' \
|
-not -path '*venv*' \
|
||||||
-not -path '*__pycache__*' \
|
-not -path '*node_modules*' \
|
||||||
-type d | cut -c 11- | fzy)
|
-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"
|
[ -n "$res" ] && cd /home/usr/"$res"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue