motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 3ac95c4dde854d259147dfc8e008e3ca1db57a28 (tree)
parent 409b098c93bc7d8345b1de300f9e2b8c3dce2add
Author: Tim Pope <code@tpope.net>
Date:   Fri,  6 Apr 2018 14:52:53 -0400

Add support for :tab Gcommit

References https://github.com/tpope/vim-fugitive/issues/1011

Diffstat:
Mplugin/fugitive.vim | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -1064,9 +1064,10 @@ endfunction " Section: Gcommit -call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)") +call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit('<mods>', <q-args>)") -function! s:Commit(args, ...) abort +function! s:Commit(mods, args, ...) abort + let mods = s:gsub(a:mods ==# '<mods>' ? '' : a:mods, '<tab>', '-tab') let repo = a:0 ? a:1 : s:repo() let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let dir = getcwd() @@ -1119,15 +1120,15 @@ function! s:Commit(args, ...) abort let args = '--cleanup=strip '.args endif if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod - execute 'keepalt edit '.s:fnameescape(msgfile) - elseif a:args =~# '\%(^\| \)-\%(-verbose\|\w*v\)\>' - execute 'keepalt -tabedit '.s:fnameescape(msgfile) + execute mods 'keepalt edit' s:fnameescape(msgfile) + elseif a:args =~# '\%(^\| \)-\%(-verbose\|\w*v\)\>' || mods =~# '\<tab\>' + execute mods 'keepalt -tabedit' s:fnameescape(msgfile) elseif s:buffer().type() ==# 'index' - execute 'keepalt edit '.s:fnameescape(msgfile) + execute mods 'keepalt edit' s:fnameescape(msgfile) execute (search('^#','n')+1).'wincmd+' setlocal nopreviewwindow else - execute 'keepalt split '.s:fnameescape(msgfile) + execute mods 'keepalt split' s:fnameescape(msgfile) endif let b:fugitive_commit_arguments = args setlocal bufhidden=wipe filetype=gitcommit @@ -1163,7 +1164,7 @@ function! s:FinishCommit() abort let args = getbufvar(+expand('<abuf>'),'fugitive_commit_arguments') if !empty(args) call setbufvar(+expand('<abuf>'),'fugitive_commit_arguments','') - return s:Commit(args, s:repo(getbufvar(+expand('<abuf>'),'git_dir'))) + return s:Commit('', args, s:repo(getbufvar(+expand('<abuf>'),'git_dir'))) endif return '' endfunction