Set find-edit to ignore hidden dirs by default
The flag -h resets this behaviour
This commit is contained in:
parent
364ba35f99
commit
a90be0ece4
1 changed files with 14 additions and 2 deletions
|
@ -1,16 +1,28 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
ignore="-not -path */.git/*"
|
||||||
|
|
||||||
|
while test $# != 0
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h) unset ignore ;;
|
||||||
|
--) shift; break ;;
|
||||||
|
*) break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
if [ -f "$1" ]
|
if [ -f "$1" ]
|
||||||
then
|
then
|
||||||
$EDITOR $1
|
$EDITOR $1
|
||||||
else
|
else
|
||||||
if which fzf > /dev/null
|
if which fzf > /dev/null
|
||||||
then
|
then
|
||||||
file=$(find . -type f | fzf -1 -q "$*")
|
file=$(find . $ignore -type f | fzf -m -1 -q "$*")
|
||||||
found=$?
|
found=$?
|
||||||
elif which dmenu > /dev/null
|
elif which dmenu > /dev/null
|
||||||
then
|
then
|
||||||
file=$(find . -type f -name '*'"$1"'*' | sed -e 's/^\.\///' | dmenu -l 20)
|
file=$(find . $ignore -type f -name '*'"$1"'*' | sed -e 's/^\.\///' | dmenu -l 20)
|
||||||
found=$?
|
found=$?
|
||||||
else
|
else
|
||||||
echo "Found neither fzf nor dmenu"
|
echo "Found neither fzf nor dmenu"
|
||||||
|
|
Loading…
Reference in a new issue