diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 2eb4c37..1dc0e2b 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1190,6 +1190,7 @@ function! fugitive#BufReadStatus() abort nnoremap r :edit nnoremap R :edit nnoremap U :execute StageUndo() + nnoremap . : =fnameescape(StatusCfile()) nnoremap g? :help fugitive-:Gstatus nnoremap :help fugitive-:Gstatus catch /^fugitive:/ @@ -3328,20 +3329,22 @@ function! fugitive#MapJumps(...) abort nnoremap cS :exe 'Gvsplit ' . fnameescape(ContainingCommit()) nnoremap cO :exe 'Gtabedit ' . fnameescape(ContainingCommit()) nnoremap cp :exe 'Gpedit ' . fnameescape(ContainingCommit()) - nnoremap . : =fnameescape(recall()) + nmap . : endif endfunction function! s:StatusCfile(...) abort let pre = '' + let tree = FugitiveTreeForGitDir(b:git_dir) + let lead = s:cpath(tree, getcwd()) ? './' : tree . '/' if getline('.') =~# '^.\=\trenamed:.* -> ' - return '/'.matchstr(getline('.'),' -> \zs.*') + return lead . matchstr(getline('.'),' -> \zs.*') elseif getline('.') =~# '^.\=\t\(\k\| \)\+\p\?: *.' - return '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$') + return lead . matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$') elseif getline('.') =~# '^.\=\t.' - return '/'.matchstr(getline('.'),'\t\zs.*') + return lead . matchstr(getline('.'),'\t\zs.*') elseif getline('.') =~# ': needs merge$' - return '/'.matchstr(getline('.'),'.*\ze: needs merge$') + return lead . matchstr(getline('.'),'.*\ze: needs merge$') elseif getline('.') =~# '^\%(. \)\=Not currently on any branch.$' return 'HEAD' elseif getline('.') =~# '^\%(. \)\=On branch ' @@ -3354,8 +3357,8 @@ function! s:StatusCfile(...) abort endfunction function! fugitive#StatusCfile() abort - let file = s:StatusCfile() - return empty(file) ? "\\" : s:fnameescape(s:Generate(file)) + let file = s:Generate(s:StatusCfile()) + return empty(file) ? "\\" : s:fnameescape(file) endfunction function! s:cfile() abort diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 909cc6c..20ea971 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -63,6 +63,7 @@ that are part of Git repositories). U |:Git| checkout HEAD (staged files) U |:Git| clean (untracked files) U |:Git| rm (unmerged files) + . enter |:| command line with file prepopulated *fugitive-:Gcommit* :Gcommit [args] A wrapper around git-commit. If there is nothing @@ -304,10 +305,6 @@ P Go to the current file in the [count]th parent. *fugitive-C* C Go to the commit containing the current file. - *fugitive-.* -. Start a |:| command line with the current - |fugitive-object| prepopulated at the end of the line. - *fugitive-a* a Show the current tag, commit, or tree in an alternate format.