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,6 +25,7 @@ hist() {
|
||||||
}
|
}
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
|
if [ "$1" = '-a' ]; then
|
||||||
res=$(find /home/usr/ /home/usr/doc/ \
|
res=$(find /home/usr/ /home/usr/doc/ \
|
||||||
-mindepth 1 \
|
-mindepth 1 \
|
||||||
-not -path '*/.*' \
|
-not -path '*/.*' \
|
||||||
|
@ -34,6 +35,16 @@ search() {
|
||||||
-not -path '*node_modules*' \
|
-not -path '*node_modules*' \
|
||||||
-not -path '*__pycache__*' \
|
-not -path '*__pycache__*' \
|
||||||
-type d | cut -c 11- | fzy)
|
-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