diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index eb50d52..b25a6a2 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2946,6 +2946,22 @@ function! fugitive#Result(...) abort endif endfunction +function! s:TempDotMap() abort + let cfile = s:cfile() + if empty(cfile) + return expand('') + endif + let name = fugitive#Find(cfile[0]) + let [dir, commit, file] = s:DirCommitFile(name) + if len(commit) && empty(file) + return commit + elseif s:cpath(s:Tree(), getcwd()) + return fugitive#Path(name, "./") + else + return fugitive#Real(name) + endif +endfunction + function! s:TempReadPre(file) abort if has_key(s:temp_files, s:cpath(a:file)) let dict = s:temp_files[s:cpath(a:file)] @@ -2970,6 +2986,8 @@ function! s:TempReadPost(file) abort endif if get(dict, 'filetype', '') ==# 'git' call fugitive#MapJumps() + call s:Map('n', '.', ": =fnameescape(TempDotMap())") + call s:Map('x', '.', ": =fnameescape(TempDotMap())") endif if has_key(dict, 'filetype') if dict.filetype ==# 'man' && has('nvim')