Skip to content

Commit 56854d9

Browse files
committed
Complete relative paths with leading word chars
1 parent a49ef6c commit 56854d9

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
@@ -43,6 +43,9 @@ Execute (prompt: relative path, empty string):
4343
Execute (prompt: relative path, whitespace only):
4444
AssertEqual grepper#complete_files('x ', v:null, v:null), ['x ./foo/']
4545

46+
Execute (prompt: relative path, leading word chars):
47+
AssertEqual grepper#complete_files('x f', v:null, v:null), ['x ./foo/']
48+
4649
Execute (prompt: sub-path, ./ exact match):
4750
AssertEqual grepper#complete_files('x ./', v:null, v:null), ['x ./foo/']
4851

0 commit comments

Comments
 (0)