Unstage single files from git move and do not move them back

This fixes #824
This commit is contained in:
kaihowl
2017-05-14 12:48:03 +02:00
committed by Tim Pope
parent e5935c1165
commit 1d2f150331

View File

@@ -975,11 +975,14 @@ function! s:StageToggle(lnum1,lnum2) abort
continue continue
endif endif
execute lnum execute lnum
if filename =~ ' -> ' if section ==# 'staged'
let cmd = ['mv','--'] + reverse(split(filename,' -> ')) if filename =~ ' -> '
let filename = cmd[-1] let files_to_unstage = split(filename,' -> ')
elseif section ==# 'staged' else
let cmd = ['reset','-q','--',filename] let files_to_unstage = [filename]
endif
let filename = files_to_unstage[-1]
let cmd = ['reset','-q','--'] + files_to_unstage
elseif getline(lnum) =~# '^#\tdeleted:' elseif getline(lnum) =~# '^#\tdeleted:'
let cmd = ['rm','--',filename] let cmd = ['rm','--',filename]
elseif getline(lnum) =~# '^#\tmodified:' elseif getline(lnum) =~# '^#\tmodified:'