Skip to content

Commit

Permalink
Complete relative paths with leading word chars
Browse files Browse the repository at this point in the history
  • Loading branch information
mmrwoods committed May 6, 2022
1 parent a49ef6c commit 7078904
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/grepper.vim
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ endfunction
function! grepper#complete_files(lead, _line, _pos)
let [head, path] = s:extract_path(a:lead)
" handle relative paths
if empty(path) || (path =~ '\s$')
if empty(path) || (path =~ '\s$') || (path =~ '^\s*\w\+')
return map(split(globpath('.'.s:slash, path.'*'), '\n'), 'head . "." . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
" handle sub paths
elseif path =~ '^.\/'
Expand Down
3 changes: 3 additions & 0 deletions test/feature/completion.vader
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Execute (prompt: relative path, empty string):
Execute (prompt: relative path, whitespace only):
AssertEqual grepper#complete_files('x ', v:null, v:null), ['x ./foo/']

Execute (prompt: relative path, leading word chars):
AssertEqual grepper#complete('x f', v:null, v:null), ['x ./foo/']

Execute (prompt: sub-path, ./ exact match):
AssertEqual grepper#complete_files('x ./', v:null, v:null), ['x ./foo/']

Expand Down

0 comments on commit 7078904

Please sign in to comment.