Hi Bram and developers,
When we git committing, we can use Vim's standard bundled command
`:DiffGitCached`. (see :help ft-gitcommit-plugin)
This command is very useful. But we can't specified modifier.
So I wrote a patch to make it possible.
Example:
:botright DiffGitCached
:belowright DiffGitCached
How about this?
--
Best regards,
Hirohito Higashi (h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim
index 6767ff7..e683dcd 100644
--- a/runtime/ftplugin/gitcommit.vim
+++ b/runtime/ftplugin/gitcommit.vim
@@ -24,7 +24,7 @@ if !exists("b:git_dir")
let b:git_dir = expand("%:p:h")
endif
-command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
+command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<q-mods>,<bang>0,b:git_dir,<f-args>)
let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached"
@@ -42,7 +42,7 @@ function! s:diffcomplete(A,L,P)
return args
endfunction
-function! s:gitdiffcached(bang,gitdir,...)
+function! s:gitdiffcached(mods,bang,gitdir,...)
let tree = fnamemodify(a:gitdir,':h')
let name = tempname()
let git = "git"
@@ -55,7 +55,7 @@ function! s:gitdiffcached(bang,gitdir,...)
let extra = "-p --stat=".&columns
endif
call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name))
- exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
+ exe a:mods "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
wincmd P
let b:git_dir = a:gitdir
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)