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
|
||||
let add = []
|
||||
let reset = []
|
||||
let intend = []
|
||||
|
||||
for lnum in range(a:lnum1,a:lnum2)
|
||||
let info = s:StageInfo(lnum)
|
||||
@ -2985,11 +2986,16 @@ function! s:StagePatch(lnum1,lnum2) abort
|
||||
execute lnum
|
||||
if info.section ==# 'Staged'
|
||||
let reset += info.relative
|
||||
elseif info.section ==# 'Untracked'
|
||||
let intend += info.paths
|
||||
elseif info.status !~# '^D'
|
||||
let add += info.relative
|
||||
endif
|
||||
endfor
|
||||
try
|
||||
if !empty(intend)
|
||||
call s:TreeChomp(['add', '--intent-to-add', '--'] + intend)
|
||||
endif
|
||||
if !empty(add)
|
||||
execute "Git add --patch -- ".join(map(add,'s:fnameescape(v:val)'))
|
||||
endif
|
||||
|
@ -270,6 +270,14 @@ X Discard the change under the cursor. This uses
|
||||
*fugitive_>*
|
||||
> 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*
|
||||
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.
|
||||
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*
|
||||
Navigation mappings ~
|
||||
|
Loading…
Reference in New Issue
Block a user