mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-09 12:03:47 -05:00
Select neighboring file after "-" in :Gstatus
This commit is contained in:
@@ -532,10 +532,7 @@ function! s:StageToggle(lnum1,lnum2) abort
|
|||||||
if getline('.') == '# Changes to be committed:'
|
if getline('.') == '# Changes to be committed:'
|
||||||
return 'Gcommit'
|
return 'Gcommit'
|
||||||
endif
|
endif
|
||||||
let filename = matchstr(line,'^#\t[[:alpha:] ]\+: *\zs.*')
|
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
|
||||||
if filename ==# ''
|
|
||||||
let filename = matchstr(line,'^#\t\zs.*')
|
|
||||||
endif
|
|
||||||
if filename ==# ''
|
if filename ==# ''
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@@ -557,10 +554,15 @@ function! s:StageToggle(lnum1,lnum2) abort
|
|||||||
let output .= call(s:repo().git_chomp_in_tree,cmd,s:repo())."\n"
|
let output .= call(s:repo().git_chomp_in_tree,cmd,s:repo())."\n"
|
||||||
endfor
|
endfor
|
||||||
if exists('first_filename')
|
if exists('first_filename')
|
||||||
|
let jump = first_filename
|
||||||
|
let f = matchstr(getline(a:lnum1-1),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
|
||||||
|
if f !=# '' | let jump = f | endif
|
||||||
|
let f = matchstr(getline(a:lnum2+1),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
|
||||||
|
if f !=# '' | let jump = f | endif
|
||||||
silent! edit!
|
silent! edit!
|
||||||
1
|
1
|
||||||
redraw
|
redraw
|
||||||
call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\$','W')
|
call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.jump.'\$','W')
|
||||||
endif
|
endif
|
||||||
echo s:sub(s:gsub(output,'\n+','\n'),'\n$','')
|
echo s:sub(s:gsub(output,'\n+','\n'),'\n$','')
|
||||||
catch /^fugitive:/
|
catch /^fugitive:/
|
||||||
@@ -580,10 +582,7 @@ function! s:StagePatch(lnum1,lnum2) abort
|
|||||||
elseif line == '# Changed but not updated:'
|
elseif line == '# Changed but not updated:'
|
||||||
return 'Git add --patch'
|
return 'Git add --patch'
|
||||||
endif
|
endif
|
||||||
let filename = matchstr(line,'^#\t[[:alpha:] ]\+: *\zs.*')
|
let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
|
||||||
if filename ==# ''
|
|
||||||
let filename = matchstr(line,'^#\t\zs.*')
|
|
||||||
endif
|
|
||||||
if filename ==# ''
|
if filename ==# ''
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user