Skip to content

Commit 38f2a3a

Browse files
committed
Merge branch 'improve-file-completion'
Manually merge in mhinz#256.
2 parents 62b7533 + e78901e commit 38f2a3a

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
doc/tags
2+
test/vader.vim

plugin/grepper.vim

+2-11
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,14 @@ function! grepper#complete(lead, line, _pos) abort
228228
return filter(map(sort(copy(g:grepper.tools)), 'v:val." "'),
229229
\ 'empty(a:lead) || v:val[:strlen(a:lead)-1] ==# a:lead')
230230
else
231-
return grepper#complete_files(a:lead, 0, 0)
231+
return []
232232
endif
233233
endfunction
234234

235235
" grepper#complete_files() {{{2
236236
function! grepper#complete_files(lead, _line, _pos)
237237
let [head, path] = s:extract_path(a:lead)
238-
" handle relative paths
239-
if empty(path) || (path =~ '\s$')
240-
return map(split(globpath('.'.s:slash, path.'*'), '\n'), 'head . "." . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
241-
" handle sub paths
242-
elseif path =~ '^.\/'
243-
return map(split(globpath('.'.s:slash, path[2:].'*'), '\n'), 'head . "." . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
244-
" handle absolute paths
245-
elseif path[0] == '/'
246-
return map(split(globpath(s:slash, path.'*'), '\n'), 'head . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
247-
endif
238+
return map(getcompletion(path, 'file'), 'head . v:val')
248239
endfunction
249240

250241
" s:extract_path() {{{2

0 commit comments

Comments
 (0)