Add :Git add --intent-to-add to :Gstatus P
This commit is contained in:
parent
ce283cbdbf
commit
55cb58cd5f
@ -2970,6 +2970,7 @@ endfunction
|
|||||||
function! s:StagePatch(lnum1,lnum2) abort
|
function! s:StagePatch(lnum1,lnum2) abort
|
||||||
let add = []
|
let add = []
|
||||||
let reset = []
|
let reset = []
|
||||||
|
let intend = []
|
||||||
|
|
||||||
for lnum in range(a:lnum1,a:lnum2)
|
for lnum in range(a:lnum1,a:lnum2)
|
||||||
let info = s:StageInfo(lnum)
|
let info = s:StageInfo(lnum)
|
||||||
@ -2985,11 +2986,16 @@ function! s:StagePatch(lnum1,lnum2) abort
|
|||||||
execute lnum
|
execute lnum
|
||||||
if info.section ==# 'Staged'
|
if info.section ==# 'Staged'
|
||||||
let reset += info.relative
|
let reset += info.relative
|
||||||
|
elseif info.section ==# 'Untracked'
|
||||||
|
let intend += info.paths
|
||||||
elseif info.status !~# '^D'
|
elseif info.status !~# '^D'
|
||||||
let add += info.relative
|
let add += info.relative
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
try
|
try
|
||||||
|
if !empty(intend)
|
||||||
|
call s:TreeChomp(['add', '--intent-to-add', '--'] + intend)
|
||||||
|
endif
|
||||||
if !empty(add)
|
if !empty(add)
|
||||||
execute "Git add --patch -- ".join(map(add,'s:fnameescape(v:val)'))
|
execute "Git add --patch -- ".join(map(add,'s:fnameescape(v:val)'))
|
||||||
endif
|
endif
|
||||||
|
@ -270,6 +270,14 @@ X Discard the change under the cursor. This uses
|
|||||||
*fugitive_>*
|
*fugitive_>*
|
||||||
> Remove the inline diff of the file under the cursor.
|
> Remove the inline diff of the file under the cursor.
|
||||||
|
|
||||||
|
P Invoke |:Git| add --patch or reset --patch on the file
|
||||||
|
under the cursor. On untracked files, this instead
|
||||||
|
calls |:Git| add --intent-to-add.
|
||||||
|
|
||||||
|
*fugitive_dp*
|
||||||
|
dp Invoke |:Git!| diff on the file under the cursor.
|
||||||
|
Deprecated in favor of inline diffs.
|
||||||
|
|
||||||
*fugitive_dd*
|
*fugitive_dd*
|
||||||
dd Perform a |:Gdiffsplit| on the file under the cursor.
|
dd Perform a |:Gdiffsplit| on the file under the cursor.
|
||||||
|
|
||||||
@ -280,13 +288,6 @@ dv Perform a |:Gvdiffsplit| on the file under the cursor.
|
|||||||
ds Perform a |:Ghdiffsplit| on the file under the cursor.
|
ds Perform a |:Ghdiffsplit| on the file under the cursor.
|
||||||
dh
|
dh
|
||||||
|
|
||||||
*fugitive_dp*
|
|
||||||
dp Invoke |:Git!| diff on the file under the cursor.
|
|
||||||
Deprecated in favor of inline diffs. On untracked
|
|
||||||
files, this instead calls |:Git| add --intent-to-add.
|
|
||||||
|
|
||||||
P Invoke |:Git| add --patch or reset --patch on the file
|
|
||||||
under the cursor.
|
|
||||||
|
|
||||||
*fugitive-navigation-mappings*
|
*fugitive-navigation-mappings*
|
||||||
Navigation mappings ~
|
Navigation mappings ~
|
||||||
|
Loading…
Reference in New Issue
Block a user