Skip to content

Commit

Permalink
Revert "Handle sub-paths as relative paths when completing"
Browse files Browse the repository at this point in the history
Although the tests for grepper#complete still pass after this change,
when completing from the prompt, each completion after this adds another
leading dot and slash, which suggests that maybe I need to testing
grepper#complete_files directly (prompt uses grepper#complete_files).

This reverts commit 5132e85.
  • Loading branch information
mmrwoods committed Apr 23, 2022
1 parent 5132e85 commit f1b96e1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugin/grepper.vim
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ function! grepper#complete_files(lead, _line, _pos)
" handle paths in $HOME (~/foo)
elseif path[0:1] ==# '~/'
return map(split(globpath($HOME, path[2:].'*'), '\n'), 'head . "~" . v:val['.len($HOME).':] . (isdirectory(v:val) ? s:slash : "")')
" handle sub paths
elseif path =~ '^.\/'
return map(split(globpath('.'.s:slash, path[2:].'*'), '\n'), 'head . "." . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
" handle absolute paths
elseif path[0] == '/'
return map(split(globpath(s:slash, path.'*'), '\n'), 'head . v:val[1:] . (isdirectory(v:val) ? s:slash : "")')
Expand Down

0 comments on commit f1b96e1

Please sign in to comment.