motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 12e015175043078451fde1544df4fd525bd85e25 (tree)
parent 887d86e920b88dc20b377f224ab0ff18d59669fa
Author: Tim Pope <code@tpope.net>
Date:   Sun,  5 Aug 2018 23:45:50 -0400

Adjust completion of /absolute/paths

Support for an initial slash to access a work tree file is being phased
out.

Diffstat:
Mautoload/fugitive.vim | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -973,8 +973,8 @@ endfunction function! fugitive#PathComplete(base, ...) abort let dir = a:0 == 1 ? a:1 : get(b:, 'git_dir', '') let tree = FugitiveTreeForGitDir(dir) . '/' - let strip = '^\%(:\=/\|:(top)\|:(top,literal)\|:(literal,top)\|:(literal)\)\%(\./\)\=' - let base = substitute(a:base, strip, '', '') + let strip = '^\%(:/\|:(top)\|:(top,literal)\|:(literal,top)\|:(literal)\)\%(\./\)\=' + let base = substitute((a:base =~# '^/' ? '.' : '') . a:base, strip, '', '') if base =~# '^\.git/' let pattern = s:gsub(base[5:-1], '/', '*&').'*' let matches = s:GlobComplete(dir . '/', pattern) @@ -984,11 +984,16 @@ function! fugitive#PathComplete(base, ...) abort endif call s:Uniq(matches) call map(matches, "'.git/' . v:val") + elseif base =~# '^\~/' + let matches = map(s:GlobComplete(expand('~/'), base[2:-1] . '*'), '"~/" . v:val') elseif len(tree) > 1 let matches = s:GlobComplete(tree, s:gsub(base, '/', '*&').'*') else let matches = [] endif + if empty(matches) && a:base =~# '^/\|^\a\+:' + let matches = s:GlobComplete('', a:base . '*') + endif call map(matches, 's:fnameescape(s:Slash(matchstr(a:base, strip) . v:val))') return matches endfunction