stupidcomputer
5f32ddeb26
instead of searching ~/doc, search the current directory. the old functionality can be restored by passing -a to the function.
51 lines
928 B
Bash
51 lines
928 B
Bash
#!/bin/bash
|
|
|
|
# some housekeeping
|
|
shopt -s autocd
|
|
alias ls="ls --color=auto"
|
|
alias ll="ls -lah --color=auto"
|
|
|
|
PS1="\h:\w\$ "
|
|
|
|
repos() {
|
|
sel="$(ls ~/git | fzy | awk '{print "/home/usr/git/"$1}')"
|
|
[ "$?" -eq 1 ] && exit
|
|
|
|
cd "$sel"
|
|
}
|
|
|
|
hist() {
|
|
res=$(cat ~/.config/bash/hist | \
|
|
sort | \
|
|
uniq | \
|
|
shuf | \
|
|
fzy)
|
|
|
|
[ -n "$res" ] && $($res)
|
|
}
|
|
|
|
search() {
|
|
if [ "$1" = '-a' ]; then
|
|
res=$(find /home/usr/ /home/usr/doc/ \
|
|
-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)
|
|
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"
|
|
}
|