diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index f334e36..74716c2 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -64,6 +64,17 @@ function! s:shellslash(path) endif endfunction +function! s:recall() + let rev = s:buffer().rev() + if rev ==# ':' + let filename = matchstr(getline('.'),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( (new commits)\)\=$\|^\d\{6} \x\{40\} \d\t\zs.*') + if filename !=# '' + return filename + endif + endif + return rev +endfunction + function! s:add_methods(namespace, method_names) abort for name in a:method_names let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name) @@ -131,7 +142,7 @@ function! s:Detect(path) endif if exists('b:git_dir') silent doautocmd User Fugitive - cnoremap fugitive#buffer().rev() + cnoremap recall() let buffer = fugitive#buffer() if expand('%:p') =~# '//' call buffer.setvar('&path',s:sub(buffer.getvar('&path'),'^\.%(,|$)',''))