From f3dde245b3f0a6f21faf1a0c6eb8c4811d02c5fd Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 29 Jul 2019 17:03:59 -0400 Subject: [PATCH] Map I to :Git add --intent-to-add --- autoload/fugitive.vim | 4 +++- doc/fugitive.txt | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index fbebed1..a3f45ca 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1826,6 +1826,8 @@ function! fugitive#BufReadStatus() abort nnoremap d? :help fugitive_d nnoremap P :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap P :execute StagePatch(line("'<"),line("'>")) + nnoremap I :execute StagePatch(line('.'),line('.')) + xnoremap I :execute StagePatch(line("'<"),line("'>")) if empty(mapcheck('q', 'n')) nnoremap q :if bufnr('$') == 1quitelsebdeleteendif endif @@ -2958,7 +2960,7 @@ function! s:DoUnstageStaged(record) abort endfunction function! s:DoToggleUnstaged(record) abort - if a:record.patch + if a:record.patch && a:record.status !=# 'A' return s:StageApply(a:record, 0, ['--cached']) else call s:TreeChomp(['add', '-A', '--'] + a:record.paths) diff --git a/doc/fugitive.txt b/doc/fugitive.txt index b702e83..92a6e71 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -274,8 +274,9 @@ X Discard the change under the cursor. This uses gI Open .git/info/exclude in a split and add the file under the cursor. Use a count to open .gitignore. -P Invoke |:Git| add --patch or reset --patch on the file - under the cursor. On untracked files, this instead + *fugitive_I* +I Invoke |:Git| add --patch or reset --patch on the file +P under the cursor. On untracked files, this instead calls |:Git| add --intent-to-add. *fugitive_d*