File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
SYNOPSIS
10
- v [-a] [-l] [-[0-9]] [--debug] [--help] [regex1 regex2 ... regexn]
10
+ v [-a] [-c] [- l] [-[0-9]] [--debug] [--help] [regex1 regex2 ... regexn]
11
11
12
12
13
13
AVAILABILITY
@@ -30,6 +30,7 @@ DESCRIPTION
30
30
31
31
OPTIONS
32
32
-a don't skip deleted files
33
+ -c restrict matches to subdirectories of the current dir
33
34
-l when multiple matches, show a list
34
35
-[0-9] edit nth most recent file
35
36
--debug dry run
@@ -40,6 +41,7 @@ EXAMPLES
40
41
v list and choose from all files
41
42
v -0 reopen most recently edited file
42
43
v foo bar edit first file matching foo and bar
44
+ v -c foo bar choose files in current dir matching foo and bar
43
45
v -l foo bar list and choose files matching foo and bar
44
46
45
47
Original file line number Diff line number Diff line change 3
3
[ " $vim " ] || vim=vim
4
4
[ $viminfo ] || viminfo=~ /.viminfo
5
5
6
- usage=" $( basename $0 ) [-a] [-l] [-[0-9]] [--debug] [--help] [regexes]"
6
+ usage=" $( basename $0 ) [-a] [-c] [- l] [-[0-9]] [--debug] [--help] [regexes]"
7
7
8
8
[ $1 ] || list=1
9
9
10
+ _pwd=" $( command pwd) "
11
+
10
12
fnd=()
11
13
for x; do case $x in
12
14
-a) deleted=1;;
15
+ -c) subdir=1; shift ;;
13
16
-l) list=1;;
14
17
-[0-9]) edit=${x: 1} ; shift ;;
15
18
--help) echo $usage ; exit ;;
@@ -27,11 +30,18 @@ set -- "${fnd[@]}"
27
30
while IFS=" " read line; do
28
31
[ " ${line: 0: 1} " = " >" ] || continue
29
32
fl=${line: 2}
30
- [ -f " ${fl/ \~ / $HOME / } " -o " $deleted " ] || continue
33
+ _fl=" ${fl/ ~\/ / $HOME / } "
34
+ [ -f " $_fl " -o " $deleted " ] || continue
31
35
match=1
32
36
for x; do
33
37
[[ " $fl " =~ $x ]] || match=
34
38
done
39
+ [ " $subdir " ] && {
40
+ case " $_fl " in
41
+ $_pwd * );;
42
+ * ) match=;;
43
+ esac
44
+ }
35
45
[ " $match " ] || continue
36
46
i=$(( i+ 1 ))
37
47
files[$i ]=" $fl "
Original file line number Diff line number Diff line change 4
4
v \- z for vim
5
5
6
6
.SH SYNOPSIS
7
- v [\- a] [\- l] [\- [0\- 9]] [\-\- debug] [\-\- help] [regex1 regex2 ... regexn]
7
+ v [\- a] [\- c] [ \- l] [\- [0\- 9]] [\-\- debug] [\-\- help] [regex1 regex2 ... regexn]
8
8
9
9
.SH AVAILABILITY
10
10
bash, vim
@@ -25,6 +25,8 @@ provided regular expressions.
25
25
.SH OPTIONS
26
26
\fB \- a \fR don't skip deleted files
27
27
.br
28
+ \fB \- c \fR restrict matches to subdirectories of the current dir
29
+ .br
28
30
\fB \- l \fR when multiple matches, show a list
29
31
.br
30
32
\fB \- [0 \- 9] \fR edit nth most recent file
@@ -40,6 +42,8 @@ provided regular expressions.
40
42
.br
41
43
\fB v foo bar \fR edit first file matching foo and bar
42
44
.br
45
+ \fB v -c foo bar \fR choose files in current dir matching foo and bar
46
+ .br
43
47
\fB v -l foo bar \fR list and choose files matching foo and bar
44
48
45
49
.SH NOTES
You can’t perform that action at this time.
0 commit comments