From 994d1b518f17918d42d56b03b15f74fdbc460801 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 23 Jul 2019 19:36:18 -0400 Subject: [PATCH] Remove --intend-to-add from :Gstatus i You can't actually apply a hunk to a file added with --intend-to-add, so this did not pair well with the hunk expansion behavior. --- autoload/fugitive.vim | 12 ++++-------- doc/fugitive.txt | 9 ++++----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 4975bab..dd1b98e 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1808,7 +1808,7 @@ function! fugitive#BufReadStatus() abort nnoremap gr :exe StageJump(v:count, 'Rebasing') nnoremap C :Gcommit:echohl WarningMsgecho ':Gstatus C is deprecated in favor of cc'echohl NONE nnoremap a :execute Do('Toggle',0) - nnoremap i :execute StageIntend(v:count1) + nnoremap i :execute NextExpandedHunk(v:count1) exe 'nnoremap ' nowait "= :execute StageInline('toggle',line('.'),v:count)" exe 'nnoremap ' nowait "< :execute StageInline('show', line('.'),v:count)" exe 'nnoremap ' nowait "> :execute StageInline('hide', line('.'),v:count)" @@ -2730,19 +2730,15 @@ function! s:StageInline(mode, ...) abort return lnum endfunction -function! s:StageIntend(count) abort +function! s:NextExpandedHunk(count) abort for i in range(a:count) - if getline('.')[0:1] ==# '? ' - call s:TreeChomp('add', '--intent-to-add', '--', s:Tree() . '/' . getline('.')[2:-1]) - - - exe s:ReloadStatus() - elseif getline('.') =~# '^Unstaged\|^Untracked' + if getline('.') =~# '^Unstaged\|^Untracked' call s:TreeChomp('add', '--intent-to-add', '--', s:Tree()) exe s:ReloadStatus() else call s:StageInline('show', line('.'), 1) endif - call s:NextFileHunk(1) + call search('^[A-Z?] .\|^diff --\|^@','W') endfor return '.' endfunction diff --git a/doc/fugitive.txt b/doc/fugitive.txt index c78d12e..ed51077 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -270,11 +270,6 @@ X Discard the change under the cursor. This uses *fugitive_>* > Remove the inline diff of the file under the cursor. - *fugitive_i* -i On untracked files, call |:Git| add --intent-to-add. - Otherwise, move to next hunk, expanding inline diffs - automatically. - *fugitive_dd* dd Perform a |:Gdiffsplit| on the file under the cursor. @@ -328,6 +323,10 @@ C Open the commit containing the current file. ) Jump to the next file or hunk. + *fugitive_i* +i Jump to the next file or hunk, expanding inline diffs + automatically. + *fugitive_[[* [[ Jump to the previous section.