Skip to content

Commit de7f0c7

Browse files
committed
Complete relative paths with leading word chars
1 parent 35c4e6b commit de7f0c7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

plugin/grepper.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ endfunction
236236
function! grepper#complete_files(lead, _line, _pos)
237237
let [head, path] = s:extract_path(a:lead)
238238
" handle relative paths
239-
if empty(path) || (path =~ '\s$')
239+
if empty(path) || (path =~ '\s$') || (path =~ '^\s*\w\+')
240240
return map(split(globpath('.'.s:slash, path.'*'), '\n'), 'head . "." . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
241241
" handle sub paths
242242
elseif path =~ '^.\/'

test/feature/completion.vader

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ Execute (relative path, empty string):
3939
Execute (relative path, whitespace only):
4040
AssertEqual grepper#complete(' ', '', v:null), [' ./foo/']
4141

42+
Execute (relative path, leading word chars):
43+
AssertEqual grepper#complete('f', '', v:null), ['./foo/']
44+
4245
Execute (sub-path, ./ exact match):
4346
AssertEqual grepper#complete('./', '', v:null), ['./foo/']
4447

0 commit comments

Comments
 (0)