<C-R><C-G> in Gstatus recalls cursor line filename
This commit is contained in:
parent
78b405fd52
commit
8548a9c621
@ -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 <expr> <buffer> <C-R><C-G> fugitive#buffer().rev()
|
||||
cnoremap <expr> <buffer> <C-R><C-G> <SID>recall()
|
||||
let buffer = fugitive#buffer()
|
||||
if expand('%:p') =~# '//'
|
||||
call buffer.setvar('&path',s:sub(buffer.getvar('&path'),'^\.%(,|$)',''))
|
||||
|
Loading…
Reference in New Issue
Block a user