From d134d4981f2980cb037744b319ab7b2575ffe204 Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Thu, 28 Jan 2010 13:50:36 -0600 Subject: [PATCH] Centralize file type setting for VCSDiff and VCSReview. --- plugin/vcscommand.vim | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plugin/vcscommand.vim b/plugin/vcscommand.vim index 2a30310..d5af971 100644 --- a/plugin/vcscommand.vim +++ b/plugin/vcscommand.vim @@ -860,6 +860,24 @@ function! s:VCSGotoOriginal(bang) endif endfunction +function! s:VCSDiff(...) "{{{2 + let resultBuffer = s:ExecuteVCSCommand('Diff', a:000) + if resultBuffer > 0 + let &filetype = 'diff' + elseif resultBuffer == 0 + echomsg 'No differences found' + endif + return resultBuffer +endfunction + +function! s:VCSReview(...) "{{{2 + let resultBuffer = s:ExecuteVCSCommand('Review', a:000) + if resultBuffer > 0 + let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype') + endif + return resultBuffer +endfunction + " Function: s:VCSVimDiff(...) {{{2 function! s:VCSVimDiff(...) try @@ -1257,14 +1275,14 @@ com! -nargs=* -bang VCSAnnotate call s:VCSAnnotate(, ) com! -nargs=* -bang VCSBlame call s:VCSAnnotate(, ) com! -nargs=? -bang VCSCommit call s:VCSCommit(, ) com! -nargs=* VCSDelete call s:ExecuteVCSCommand('Delete', []) -com! -nargs=* VCSDiff call s:ExecuteVCSCommand('Diff', []) +com! -nargs=* VCSDiff call s:VCSDiff() com! -nargs=0 -bang VCSGotoOriginal call s:VCSGotoOriginal() com! -nargs=* VCSInfo call s:ExecuteVCSCommand('Info', []) com! -nargs=* VCSLock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Lock', [])) com! -nargs=* VCSLog call s:ExecuteVCSCommand('Log', []) com! -nargs=* VCSRemove call s:ExecuteVCSCommand('Delete', []) com! -nargs=0 VCSRevert call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Revert', [])) -com! -nargs=? VCSReview call s:ExecuteVCSCommand('Review', []) +com! -nargs=? VCSReview call s:VCSReview() com! -nargs=* VCSStatus call s:ExecuteVCSCommand('Status', []) com! -nargs=* VCSUnlock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Unlock', [])) com! -nargs=0 VCSUpdate call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Update', [])) -- 2.11.4.GIT