mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
Use status headers for commit maps
Closes https://github.com/tpope/vim-fugitive/issues/1485
This commit is contained in:
@@ -5822,6 +5822,8 @@ endfunction
|
|||||||
|
|
||||||
" Section: Go to file
|
" Section: Go to file
|
||||||
|
|
||||||
|
let s:ref_header = '\%(Head\|Merge\|Rebase\|Upstream\|Pull\|Push\)'
|
||||||
|
|
||||||
nnoremap <SID>: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
nnoremap <SID>: :<C-U><C-R>=v:count ? v:count : ''<CR>
|
||||||
function! fugitive#MapCfile(...) abort
|
function! fugitive#MapCfile(...) abort
|
||||||
exe 'cnoremap <buffer> <expr> <Plug><cfile>' (a:0 ? a:1 : 'fugitive#Cfile()')
|
exe 'cnoremap <buffer> <expr> <Plug><cfile>' (a:0 ? a:1 : 'fugitive#Cfile()')
|
||||||
@@ -5842,7 +5844,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:SquashArgument(...) abort
|
function! s:SquashArgument(...) abort
|
||||||
if &filetype == 'fugitive'
|
if &filetype == 'fugitive'
|
||||||
let commit = matchstr(getline('.'), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze ')
|
let commit = matchstr(getline('.'), '^\%(\%(\x\x\x\)\@!\l\+\s\+\)\=\zs[0-9a-f]\{4,\}\ze \|^' . s:ref_header . ': \zs\S\+')
|
||||||
elseif has_key(s:temp_files, s:cpath(expand('%:p')))
|
elseif has_key(s:temp_files, s:cpath(expand('%:p')))
|
||||||
let commit = matchstr(getline('.'), '\<\x\{4,\}\>')
|
let commit = matchstr(getline('.'), '\<\x\{4,\}\>')
|
||||||
else
|
else
|
||||||
@@ -6036,7 +6038,7 @@ function! s:StatusCfile(...) abort
|
|||||||
return [lead . info.relative[0]]
|
return [lead . info.relative[0]]
|
||||||
elseif len(info.commit)
|
elseif len(info.commit)
|
||||||
return [info.commit]
|
return [info.commit]
|
||||||
elseif line =~# '^\%(Head\|Merge\|Rebase\|Upstream\|Pull\|Push\): '
|
elseif line =~# '^' . s:ref_header . ': '
|
||||||
return [matchstr(line, ' \zs.*')]
|
return [matchstr(line, ' \zs.*')]
|
||||||
else
|
else
|
||||||
return ['']
|
return ['']
|
||||||
|
|||||||
Reference in New Issue
Block a user