Use unambiguous paths for :Gstatus dot map
When the current working directory isn't the work tree, use absolute paths so that pairing with both :Git and :! works as expected.
This commit is contained in:
parent
597289e64d
commit
a358191cfb
@ -1190,6 +1190,7 @@ function! fugitive#BufReadStatus() abort
|
|||||||
nnoremap <buffer> <silent> r :<C-U>edit<CR>
|
nnoremap <buffer> <silent> r :<C-U>edit<CR>
|
||||||
nnoremap <buffer> <silent> R :<C-U>edit<CR>
|
nnoremap <buffer> <silent> R :<C-U>edit<CR>
|
||||||
nnoremap <buffer> <silent> U :<C-U>execute <SID>StageUndo()<CR>
|
nnoremap <buffer> <silent> U :<C-U>execute <SID>StageUndo()<CR>
|
||||||
|
nnoremap <buffer> . : <C-R>=<SID>fnameescape(<SID>StatusCfile())<CR><Home>
|
||||||
nnoremap <buffer> <silent> g? :help fugitive-:Gstatus<CR>
|
nnoremap <buffer> <silent> g? :help fugitive-:Gstatus<CR>
|
||||||
nnoremap <buffer> <silent> <F1> :help fugitive-:Gstatus<CR>
|
nnoremap <buffer> <silent> <F1> :help fugitive-:Gstatus<CR>
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
@ -3328,20 +3329,22 @@ function! fugitive#MapJumps(...) abort
|
|||||||
nnoremap <buffer> <silent> cS :<C-U>exe 'Gvsplit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
nnoremap <buffer> <silent> cS :<C-U>exe 'Gvsplit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
||||||
nnoremap <buffer> <silent> cO :<C-U>exe 'Gtabedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
nnoremap <buffer> <silent> cO :<C-U>exe 'Gtabedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
||||||
nnoremap <buffer> <silent> cp :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
nnoremap <buffer> <silent> cp :<C-U>exe 'Gpedit ' . <SID>fnameescape(<SID>ContainingCommit())<CR>
|
||||||
nnoremap <buffer> . : <C-R>=fnameescape(<SID>recall())<CR><Home>
|
nmap <buffer> . <SID>: <Plug><cfile><Home>
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:StatusCfile(...) abort
|
function! s:StatusCfile(...) abort
|
||||||
let pre = ''
|
let pre = ''
|
||||||
|
let tree = FugitiveTreeForGitDir(b:git_dir)
|
||||||
|
let lead = s:cpath(tree, getcwd()) ? './' : tree . '/'
|
||||||
if getline('.') =~# '^.\=\trenamed:.* -> '
|
if getline('.') =~# '^.\=\trenamed:.* -> '
|
||||||
return '/'.matchstr(getline('.'),' -> \zs.*')
|
return lead . matchstr(getline('.'),' -> \zs.*')
|
||||||
elseif getline('.') =~# '^.\=\t\(\k\| \)\+\p\?: *.'
|
elseif getline('.') =~# '^.\=\t\(\k\| \)\+\p\?: *.'
|
||||||
return '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
return lead . matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
||||||
elseif getline('.') =~# '^.\=\t.'
|
elseif getline('.') =~# '^.\=\t.'
|
||||||
return '/'.matchstr(getline('.'),'\t\zs.*')
|
return lead . matchstr(getline('.'),'\t\zs.*')
|
||||||
elseif getline('.') =~# ': needs merge$'
|
elseif getline('.') =~# ': needs merge$'
|
||||||
return '/'.matchstr(getline('.'),'.*\ze: needs merge$')
|
return lead . matchstr(getline('.'),'.*\ze: needs merge$')
|
||||||
elseif getline('.') =~# '^\%(. \)\=Not currently on any branch.$'
|
elseif getline('.') =~# '^\%(. \)\=Not currently on any branch.$'
|
||||||
return 'HEAD'
|
return 'HEAD'
|
||||||
elseif getline('.') =~# '^\%(. \)\=On branch '
|
elseif getline('.') =~# '^\%(. \)\=On branch '
|
||||||
@ -3354,8 +3357,8 @@ function! s:StatusCfile(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fugitive#StatusCfile() abort
|
function! fugitive#StatusCfile() abort
|
||||||
let file = s:StatusCfile()
|
let file = s:Generate(s:StatusCfile())
|
||||||
return empty(file) ? "\<C-R>\<C-F>" : s:fnameescape(s:Generate(file))
|
return empty(file) ? "\<C-R>\<C-F>" : s:fnameescape(file)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:cfile() abort
|
function! s:cfile() abort
|
||||||
|
@ -63,6 +63,7 @@ that are part of Git repositories).
|
|||||||
U |:Git| checkout HEAD (staged files)
|
U |:Git| checkout HEAD (staged files)
|
||||||
U |:Git| clean (untracked files)
|
U |:Git| clean (untracked files)
|
||||||
U |:Git| rm (unmerged files)
|
U |:Git| rm (unmerged files)
|
||||||
|
. enter |:| command line with file prepopulated
|
||||||
|
|
||||||
*fugitive-:Gcommit*
|
*fugitive-:Gcommit*
|
||||||
:Gcommit [args] A wrapper around git-commit. If there is nothing
|
: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*
|
*fugitive-C*
|
||||||
C Go to the commit containing the current file.
|
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*
|
*fugitive-a*
|
||||||
a Show the current tag, commit, or tree in an alternate
|
a Show the current tag, commit, or tree in an alternate
|
||||||
format.
|
format.
|
||||||
|
Loading…
Reference in New Issue
Block a user