Provide "i"

This is a weird one, and might get axed.
This commit is contained in:
Tim Pope
2019-02-18 17:20:52 -05:00
parent 755554bb3c
commit f259fd5d6d
2 changed files with 24 additions and 2 deletions

View File

@@ -1553,8 +1553,8 @@ function! fugitive#BufReadStatus() abort
exe "nnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>Do('Unstage',0)<CR>"
exe "xnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>Do('Unstage',1)<CR>"
nnoremap <buffer> <silent> C :<C-U>Gcommit<CR>:echohl WarningMsg<Bar>echo ':Gstatus C is deprecated in favor of cc'<Bar>echohl NONE<CR>
nnoremap <buffer> <silent> a :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>
nnoremap <buffer> <silent> i :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>
nnoremap <buffer> <silent> a :<C-U>execute <SID>StatusDo('Toggle',0)<CR>
nnoremap <buffer> <silent> i :<C-U>execute <SID>StageIntend(v:count1)<CR>
exe 'nnoremap <buffer> <silent>' nowait "= :<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>"
exe 'nnoremap <buffer> <silent>' nowait "< :<C-U>execute <SID>StageInline('show', line('.'),v:count)<CR>"
exe 'nnoremap <buffer> <silent>' nowait "> :<C-U>execute <SID>StageInline('hide', line('.'),v:count)<CR>"
@@ -2359,6 +2359,23 @@ function! s:StageInline(mode, ...) abort
return lnum
endfunction
function! s:StageIntend(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'
call s:TreeChomp('add', '--intent-to-add', '--', s:Tree())
exe s:ReloadStatus()
else
call s:StageInline('show', line('.'), 1)
endif
call s:StageNext(1)
endfor
return '.'
endfunction
function! s:StageDiff(diff) abort
let lnum = line('.')
let info = s:StageInfo(lnum)

View File

@@ -273,6 +273,11 @@ 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 |:Gdiff| on the file under the cursor.