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 ad2e408e15e5e5ff4faddc55b5975034aff9ad36 (tree)
parent f38c59af7c72d1006f73bb4e7ffc33f1dbc4cc2a
Author: Tim Pope <code@tpope.net>
Date:   Tue,  9 Jul 2019 12:26:45 -0400

Treat :G ... ./path as relative to working directory

References https://github.com/tpope/vim-fugitive/issues/504

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

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -987,15 +987,20 @@ function! s:ExpandSplit(string, ...) abort let string = a:string let handle_bar = a:0 && a:1 let dquote = handle_bar ? '"\%([^"]\|""\|\\"\)*"\|' : '' + let cwd = a:0 > 1 ? a:2 : getcwd() while string =~# '\S' if handle_bar && string =~# '^\s*|' return [list, substitute(string, '^\s*', '', '')] endif let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] ' . (handle_bar ? '|' : '') . ']\)\+') let string = strpart(string, len(arg)) - let arg = substitute(substitute(arg, '^\s\+', '', ''), + let arg = substitute(arg, '^\s\+', '', '') + if arg =~# '^\.\.\=\%(/\|$\)' + let arg = s:DotRelative(s:Slash(simplify(getcwd() . '/' . arg)), cwd) + endif + let arg = substitute(arg, \ '\(' . dquote . '''\%(''''\|[^'']\)*''\|\\[' . s:fnameescape . ']\|^\\[>+-]\|!\d*\)\|' . s:expand, - \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5), a:0 > 1 ? a:2 : getcwd())', 'g') + \ '\=s:ExpandVar(submatch(1),submatch(2),submatch(3),submatch(5), cwd)', 'g') call add(list, arg) endwhile return handle_bar ? [list, ''] : list