Update the vcscommand stuff

git-svn-id: http://photonzero.com/dotfiles/trunk@35 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
michener 2010-03-04 01:30:11 +00:00
parent 038c882603
commit 10c20eeb99
17 changed files with 459 additions and 393 deletions

View file

@ -81,7 +81,7 @@ output appears in a new window.
Many of the commands accept revisions as arguments. By default, most operate
on the most recent revision on the current branch if no revision is specified.
Each vcscommand is mapped to a key sequence starting with the <Leader>
Each vcscommand is mapped to a key sequence starting with the |<Leader>|
keystroke. The default mappings may be overridden by supplying different
mappings before the plugin is loaded, such as in the vimrc, in the standard
fashion for plugin mappings. For examples, please see
@ -149,9 +149,8 @@ will cause the above behavior to change. Instead of annotating the version on
the current line, the parent revision is used instead, crossing branches if
necessary.
The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate',
'SVNAnnotate', 'SVKAnnotate' or 'gitAnnotate' as appropriate, to take advantage of the
bundled syntax files.
With no arguments the cursor will jump to the line in the annotated buffer
corresponding to the current line in the source buffer.
:VCSBlame[!] *:VCSBlame*
@ -172,9 +171,10 @@ log message. The commit can be abandoned if the log message buffer is deleted
or wiped before being written.
Alternatively, the mapping that is used to invoke :VCSCommit (by default
<Leader>cc) can be used in the log message buffer to immediately commit. This
is useful if the |VCSCommandCommitOnWrite| variable is set to 0 to disable the
normal commit-on-write behavior.
|<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
buffer in Normal mode to immediately commit. This is useful if the
|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
commit-on-write behavior.
:VCSDelete *:VCSDelete*
@ -329,33 +329,33 @@ This command performs "cvs watchers" on the current file.
By default, a mapping is defined for each command. These mappings execute the
default (no-argument) form of each command.
<Leader>ca VCSAdd
<Leader>cn VCSAnnotate
<Leader>cN VCSAnnotate!
<Leader>cc VCSCommit
<Leader>cD VCSDelete
<Leader>cd VCSDiff
<Leader>cg VCSGotoOriginal
<Leader>cG VCSGotoOriginal!
<Leader>ci VCSInfo
<Leader>cl VCSLog
<Leader>cL VCSLock
<Leader>cr VCSReview
<Leader>cs VCSStatus
<Leader>cu VCSUpdate
<Leader>cU VCSUnlock
<Leader>cv VCSVimDiff
|<Leader>|ca VCSAdd
|<Leader>|cn VCSAnnotate
|<Leader>|cN VCSAnnotate!
|<Leader>|cc VCSCommit
|<Leader>|cD VCSDelete
|<Leader>|cd VCSDiff
|<Leader>|cg VCSGotoOriginal
|<Leader>|cG VCSGotoOriginal!
|<Leader>|ci VCSInfo
|<Leader>|cl VCSLog
|<Leader>|cL VCSLock
|<Leader>|cr VCSReview
|<Leader>|cs VCSStatus
|<Leader>|cu VCSUpdate
|<Leader>|cU VCSUnlock
|<Leader>|cv VCSVimDiff
Only for CVS buffers:
<Leader>ce CVSEdit
<Leader>cE CVSEditors
<Leader>ct CVSUnedit
<Leader>cwv CVSWatchers
<Leader>cwa CVSWatchAdd
<Leader>cwn CVSWatchOn
<Leader>cwf CVSWatchOff
<Leader>cwf CVSWatchRemove
|<Leader>|ce CVSEdit
|<Leader>|cE CVSEditors
|<Leader>|ct CVSUnedit
|<Leader>|cwv CVSWatchers
|<Leader>|cwa CVSWatchAdd
|<Leader>|cwn CVSWatchOn
|<Leader>|cwf CVSWatchOff
|<Leader>|cwf CVSWatchRemove
*vcscommand-mappings-override*

View file

@ -35,14 +35,15 @@
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
let s:save_cpo=&cpo
set cpo&vim
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
@ -50,18 +51,28 @@ if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:bzrFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke bzr suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the BZR executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'BZR'
let fullCmd = VCSCommandGetOption('VCSCommandBZRExec', 'bzr') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'BZR VCSCommand plugin called on non-BZR item.'
@ -73,7 +84,7 @@ endfunction
" Function: s:bzrFunctions.Identify(buffer) {{{2
function! s:bzrFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
let statusText = system(VCSCommandGetOption('VCSCommandBZRExec', 'bzr') . ' info "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
if(v:shell_error)
return 0
else
@ -89,7 +100,7 @@ endfunction
" Function: s:bzrFunctions.Annotate(argList) {{{2
function! s:bzrFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'BZRAnnotate'
if &filetype == 'BZRannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
@ -108,7 +119,6 @@ function! s:bzrFunctions.Annotate(argList)
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
set filetype=BZRAnnotate
endif
return resultBuffer
endfunction
@ -140,13 +150,7 @@ function! s:bzrFunctions.Diff(argList)
let revOptions = a:argList
endif
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
endfunction
" Function: s:bzrFunctions.GetBufferInfo() {{{2
@ -158,8 +162,8 @@ endfunction
function! s:bzrFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = system(VCSCommandGetOption('VCSCommandBZRExec', 'bzr') . ' status -S "' . fileName . '"')
let revision = system(VCSCommandGetOption('VCSCommandBZRExec', 'bzr') . ' revno "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -S -- "' . fileName . '"')
let revision = s:VCSCommandUtility.system(s:Executable() . ' revno -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -223,11 +227,7 @@ function! s:bzrFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:bzrFunctions.Status(argList) {{{2
@ -248,7 +248,10 @@ function! s:bzrFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:bzrFunctions.AnnotateSplitRegex = '^[^|]\+ | '
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('BZR', expand('<sfile>'), s:bzrFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('BZR', expand('<sfile>'), s:bzrFunctions, [])
let &cpo = s:save_cpo

View file

@ -3,7 +3,6 @@
" Vim plugin to assist in working with files under control of various Version
" Control Systems, such as CVS, SVN, SVK, and git.
"
" Version: 1.99.31
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2008 Bob Hiestand
@ -33,12 +32,11 @@
" directory and all subdirectories associated with the current buffer). The
" output of the commands is captured in a new scratch window.
"
" This plugin needs additional extension plugins, each specific to a source
" control system, to function. Those plugins should be placed in a
" subdirectory of the standard plugin directory named 'vcscommand'. Several
" options include the name of the version control system in the option name.
" Such options use the placeholder text '{VCSType}', which would be replaced
" in actual usage with 'CVS' or 'SVN', for instance.
" This plugin needs additional extension plugins, each specific to a source
" control system, to function. Several options include the name of the
" version control system in the option name. Such options use the placeholder
" text '{VCSType}', which would be replaced in actual usage with 'CVS' or
" 'SVN', for instance.
"
" Command documentation {{{2
"
@ -93,7 +91,7 @@
" VCS scratch buffers associated with the original file.
"
" VCSInfo Displays extended information about the current file in a
" new scratch buffer.
" new scratch buffer.
"
" VCSLock Locks the current file in order to prevent other users from
" concurrently modifying it. The exact semantics of this
@ -273,7 +271,7 @@
" mapping to quit a VCS scratch buffer:
"
" augroup VCSCommand
" au VCSCommand User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
" au VCSCommand User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
" augroup END
"
" The following hooks are available:
@ -336,6 +334,9 @@ let g:VCSCOMMAND_IDENTIFY_INEXACT = -1
" Section: Script variable initialization {{{1
" Hidden functions for use by extensions
let s:VCSCommandUtility = {}
" plugin-specific information: {vcs -> [script, {command -> function}, {key -> mapping}]}
let s:plugins = {}
@ -351,7 +352,7 @@ unlet! s:vimDiffRestoreCmd
" original buffer currently reflected in vimdiff windows
unlet! s:vimDiffSourceBuffer
"
"
unlet! s:vimDiffScratchList
" Section: Utility functions {{{1
@ -364,6 +365,23 @@ function! s:ReportError(error)
echohl WarningMsg|echomsg 'VCSCommand: ' . a:error|echohl None
endfunction
" Function s:VCSCommandUtility.system(...) {{{2
" Replacement for system() function. This version protects the quoting in the
" command line on Windows systems.
function! s:VCSCommandUtility.system(...)
if (has("win32") || has("win64")) && &sxq !~ '"'
let save_sxq = &sxq
set sxq=\"
endif
try
return call('system', a:000)
finally
if exists("save_sxq")
let &sxq = save_sxq
endif
endtry
endfunction
" Function: s:CreateMapping(shortcut, expansion, display) {{{2
" Creates the given mapping by prepending the contents of
@ -530,7 +548,7 @@ function! s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText)
setlocal buftype=nofile
setlocal noswapfile
let &filetype = a:vcsType . a:command
let &filetype = tolower(a:vcsType . a:command)
if VCSCommandGetOption('VCSCommandDeleteOnHide', 0)
setlocal bufhidden=delete
@ -576,7 +594,7 @@ endfunction
function! s:MarkOrigBufferForSetup(buffer)
checktime
if a:buffer > 0
if a:buffer > 0
let origBuffer = VCSCommandGetOriginalBuffer(a:buffer)
" This should never not work, but I'm paranoid
if origBuffer != a:buffer
@ -665,7 +683,7 @@ function! s:VimDiffRestore(vimDiffBuff)
endif
unlet s:vimDiffRestoreCmd
endif
endif
" All buffers are gone.
unlet s:vimDiffSourceBuffer
unlet s:vimDiffScratchList
@ -683,6 +701,10 @@ endfunction
" Function: s:VCSAnnotate(...) {{{2
function! s:VCSAnnotate(bang, ...)
try
let line = line('.')
let currentBuffer = bufnr('%')
let originalBuffer = VCSCommandGetOriginalBuffer(currentBuffer)
let annotateBuffer = s:ExecuteVCSCommand('Annotate', a:000)
if annotateBuffer == -1
return -1
@ -698,7 +720,6 @@ function! s:VCSAnnotate(bang, ...)
if splitRegex == ''
return annotateBuffer
endif
let originalBuffer = VCSCommandGetOriginalBuffer(annotateBuffer)
let originalFileType = getbufvar(originalBuffer, '&ft')
let annotateFileType = getbufvar(annotateBuffer, '&ft')
execute "normal 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
@ -710,6 +731,24 @@ function! s:VCSAnnotate(bang, ...)
call s:SetupScratchBuffer('annotate', vcsType, originalBuffer, 'header')
wincmd l
endif
if currentBuffer == originalBuffer
" Starting from the original source buffer, so the
" current line is relevant.
if a:0 == 0
" No argument list means that we're annotating
" the current version, so jumping to the same
" line is the expected action.
execute "normal" line . 'G'
if has('folding')
" The execution of the buffer created autocommand
" re-folds the buffer. Display the current line
" unfolded.
normal zv
endif
endif
endif
return annotateBuffer
catch
call s:ReportError(v:exception)
@ -767,7 +806,7 @@ endfunction
function! s:VCSFinishCommitWithBuffer()
setlocal nomodified
let currentBuffer = bufnr('%')
let currentBuffer = bufnr('%')
let logMessageList = getbufline('%', 1, '$')
call filter(logMessageList, 'v:val !~ ''^\s*VCS:''')
let resultBuffer = s:VCSFinishCommit(logMessageList, b:VCSCommandOriginalBuffer)
@ -821,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
@ -849,7 +906,7 @@ function! s:VCSVimDiff(...)
if exists('s:vimDiffSourceBuffer')
call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
endif
let resultBuffer = s:plugins[vcsType][1].Review([a:1])
let resultBuffer = s:VCSReview(a:1)
if resultBuffer < 0
echomsg 'Can''t open revision ' . a:1
return resultBuffer
@ -860,7 +917,7 @@ function! s:VCSVimDiff(...)
" If no split method is defined, cheat, and set it to vertical.
try
call s:OverrideOption('VCSCommandSplit', orientation)
let resultBuffer = s:plugins[vcsType][1].Review([a:2])
let resultBuffer = s:VCSReview(a:2)
finally
call s:OverrideOption('VCSCommandSplit')
endtry
@ -879,9 +936,9 @@ function! s:VCSVimDiff(...)
call s:OverrideOption('VCSCommandSplit', orientation)
try
if(a:0 == 0)
let resultBuffer = s:plugins[vcsType][1].Review([])
let resultBuffer = s:VCSReview()
else
let resultBuffer = s:plugins[vcsType][1].Review([a:1])
let resultBuffer = s:VCSReview(a:1)
endif
finally
call s:OverrideOption('VCSCommandSplit')
@ -905,7 +962,7 @@ function! s:VCSVimDiff(...)
wincmd W
execute 'buffer' originalBuffer
" Store info for later original buffer restore
let s:vimDiffRestoreCmd =
let s:vimDiffRestoreCmd =
\ 'call setbufvar('.originalBuffer.', ''&diff'', '.getbufvar(originalBuffer, '&diff').')'
\ . '|call setbufvar('.originalBuffer.', ''&foldcolumn'', '.getbufvar(originalBuffer, '&foldcolumn').')'
\ . '|call setbufvar('.originalBuffer.', ''&foldenable'', '.getbufvar(originalBuffer, '&foldenable').')'
@ -1047,6 +1104,7 @@ function! VCSCommandRegisterModule(name, path, commandMap, mappingMap)
call s:CreateMapping(shortcut, expansion, a:name . " extension mapping " . shortcut)
endfor
endif
return s:VCSCommandUtility
endfunction
" Function: VCSCommandDoCommand(cmd, cmdName, statusText, [options]) {{{2
@ -1068,7 +1126,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
endif
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
if originalBuffer == -1
if originalBuffer == -1
throw 'Original buffer no longer exists, aborting.'
endif
@ -1086,7 +1144,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
if match(a:cmd, '<VCSCOMMANDFILE>') > 0
let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
else
let fullCmd = a:cmd . ' "' . fileName . '"'
let fullCmd = a:cmd . ' -- "' . fileName . '"'
endif
" Change to the directory of the current buffer. This is done for CVS, but
@ -1094,7 +1152,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
let oldCwd = VCSCommandChangeToCurrentFileDir(path)
try
let output = system(fullCmd)
let output = s:VCSCommandUtility.system(fullCmd)
finally
call VCSCommandChdir(oldCwd)
endtry
@ -1217,14 +1275,14 @@ com! -nargs=* -bang VCSAnnotate call s:VCSAnnotate(<q-bang>, <f-args>)
com! -nargs=* -bang VCSBlame call s:VCSAnnotate(<q-bang>, <f-args>)
com! -nargs=? -bang VCSCommit call s:VCSCommit(<q-bang>, <q-args>)
com! -nargs=* VCSDelete call s:ExecuteVCSCommand('Delete', [<f-args>])
com! -nargs=* VCSDiff call s:ExecuteVCSCommand('Diff', [<f-args>])
com! -nargs=* VCSDiff call s:VCSDiff(<f-args>)
com! -nargs=0 -bang VCSGotoOriginal call s:VCSGotoOriginal(<q-bang>)
com! -nargs=* VCSInfo call s:ExecuteVCSCommand('Info', [<f-args>])
com! -nargs=* VCSLock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Lock', [<f-args>]))
com! -nargs=* VCSLog call s:ExecuteVCSCommand('Log', [<f-args>])
com! -nargs=* VCSRemove call s:ExecuteVCSCommand('Delete', [<f-args>])
com! -nargs=0 VCSRevert call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Revert', []))
com! -nargs=? VCSReview call s:ExecuteVCSCommand('Review', [<f-args>])
com! -nargs=? VCSReview call s:VCSReview(<f-args>)
com! -nargs=* VCSStatus call s:ExecuteVCSCommand('Status', [<f-args>])
com! -nargs=* VCSUnlock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Unlock', [<f-args>]))
com! -nargs=0 VCSUpdate call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Update', []))
@ -1323,7 +1381,7 @@ function! s:CloseAllResultBuffers()
let buffnr = 1
let buffmaxnr = bufnr('$')
while buffnr <= buffmaxnr
if getbufvar(buffnr, 'VCSCommandOriginalBuffer') != ""
if getbufvar(buffnr, 'VCSCommandOriginalBuffer') != ""
execute 'bw' buffnr
endif
let buffnr = buffnr + 1

View file

@ -32,23 +32,23 @@
" The following commands only apply to files under CVS source control.
"
" CVSEdit Performs "cvs edit" on the current file.
"
"
" CVSEditors Performs "cvs editors" on the current file.
"
"
" CVSUnedit Performs "cvs unedit" on the current file.
"
"
" CVSWatch Takes an argument which must be one of [on|off|add|remove].
" Performs "cvs watch" with the given argument on the current
" file.
"
"
" CVSWatchers Performs "cvs watchers" on the current file.
"
"
" CVSWatchAdd Alias for "CVSWatch add"
"
"
" CVSWatchOn Alias for "CVSWatch on"
"
"
" CVSWatchOff Alias for "CVSWatch off"
"
"
" CVSWatchRemove Alias for "CVSWatch remove"
"
" Mapping documentation: {{{2
@ -106,12 +106,19 @@ let s:cvsFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke cvs suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'CVS'
let fullCmd = VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
let ret = VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
if ret > 0
@ -128,11 +135,11 @@ function! s:DoCommand(cmd, cmdName, statusText, options)
endif
endfunction
" Function: GetRevision() {{{2
" Function: s:GetRevision() {{{2
" Function for retrieving the current buffer's revision number.
" Returns: Revision number or an empty string if an error occurs.
function! GetRevision()
function! s:GetRevision()
if !exists('b:VCSCommandBufferInfo')
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
endif
@ -174,7 +181,7 @@ endfunction
" Function: s:cvsFunctions.Annotate(argList) {{{2
function! s:cvsFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'CVSAnnotate'
if &filetype == 'CVSannotate'
" This is a CVSAnnotate buffer. Perform annotation of the version
" indicated by the current line.
let caption = matchstr(getline('.'),'\v^[0-9.]+')
@ -197,7 +204,7 @@ function! s:cvsFunctions.Annotate(argList)
" CVS defaults to pulling HEAD, regardless of current branch.
" Therefore, always pass desired revision.
let caption = ''
let options = ['-r' . GetRevision()]
let options = ['-r' . s:GetRevision()]
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
@ -209,7 +216,6 @@ function! s:cvsFunctions.Annotate(argList)
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
if resultBuffer > 0
set filetype=CVSAnnotate
" Remove header lines from standard error
silent v/^\d\+\%(\.\d\+\)\+/d
endif
@ -259,13 +265,7 @@ function! s:cvsFunctions.Diff(argList)
let diffOptions = ['-' . cvsDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
endfunction
" Function: s:cvsFunctions.GetBufferInfo() {{{2
@ -294,7 +294,7 @@ function! s:cvsFunctions.GetBufferInfo()
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
try
let statusText=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' status "' . realFileName . '"')
let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"')
if(v:shell_error)
return []
endif
@ -302,7 +302,7 @@ function! s:cvsFunctions.GetBufferInfo()
" We can still be in a CVS-controlled directory without this being a CVS
" file
if match(revision, '^New file!$') >= 0
if match(revision, '^New file!$') >= 0
let revision='New'
elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') <0
return ['Unknown']
@ -331,11 +331,7 @@ function! s:cvsFunctions.Log(argList)
let caption = join(a:argList, ' ')
endif
let resultBuffer=s:DoCommand(join(['log'] + options), 'log', caption, {})
if resultBuffer > 0
set filetype=rcslog
endif
return resultBuffer
return s:DoCommand(join(['log'] + options), 'log', caption, {})
endfunction
" Function: s:cvsFunctions.Revert(argList) {{{2
@ -353,11 +349,7 @@ function! s:cvsFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:cvsFunctions.Status(argList) {{{2
@ -448,6 +440,6 @@ amenu <silent> &Plugin.VCS.CVS.WatchOff <Plug>CVSWatchOff
amenu <silent> &Plugin.VCS.CVS.WatchRemove <Plug>CVSWatchRemove
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
let &cpo = s:save_cpo

View file

@ -65,12 +65,19 @@ let s:gitFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'git'
let fullCmd = VCSCommandGetOption('VCSCommandGitExec', 'git',) . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'git VCSCommand plugin called on non-git item.'
@ -85,7 +92,7 @@ endfunction
function! s:gitFunctions.Identify(buffer)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --is-inside-work-tree')
call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree')
if(v:shell_error)
return 0
else
@ -104,7 +111,7 @@ endfunction
" Function: s:gitFunctions.Annotate(argList) {{{2
function! s:gitFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'gitAnnotate'
if &filetype == 'gitannotate'
" Perform annotation of the version indicated by the current line.
let options = matchstr(getline('.'),'^\x\+')
else
@ -116,12 +123,7 @@ function! s:gitFunctions.Annotate(argList)
let options = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand('blame ' . options . ' -- ', 'annotate', options, {})
if resultBuffer > 0
normal 1G
set filetype=gitAnnotate
endif
return resultBuffer
return s:DoCommand('blame ' . options, 'annotate', options, {})
endfunction
" Function: s:gitFunctions.Commit(argList) {{{2
@ -158,13 +160,7 @@ function! s:gitFunctions.Diff(argList)
endfor
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
endfunction
" Function: s:gitFunctions.GetBufferInfo() {{{2
@ -177,7 +173,7 @@ endfunction
function! s:gitFunctions.GetBufferInfo()
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
try
let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref -q HEAD'), '\n$', '', '')
let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '')
if v:shell_error
let branch = 'DETACHED'
else
@ -190,7 +186,7 @@ function! s:gitFunctions.GetBufferInfo()
if method != ''
let method = ' --' . method
endif
let tag = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' describe' . method), '\n$', '', '')
let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '')
if !v:shell_error
call add(info, tag)
break
@ -205,11 +201,7 @@ endfunction
" Function: s:gitFunctions.Log() {{{2
function! s:gitFunctions.Log(argList)
let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
if resultBuffer > 0
set filetype=gitlog
endif
return resultBuffer
return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
endfunction
" Function: s:gitFunctions.Revert(argList) {{{2
@ -227,18 +219,14 @@ function! s:gitFunctions.Review(argList)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
try
let prefix = system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --show-prefix')
let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix')
finally
call VCSCommandChdir(oldCwd)
endtry
let prefix = substitute(prefix, '\n$', '', '')
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
let resultBuffer = s:DoCommand('show ' . blob, 'review', revision, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('show ' . blob, 'review', revision, {})
endfunction
" Function: s:gitFunctions.Status(argList) {{{2
@ -255,6 +243,6 @@ endfunction
let s:gitFunctions.AnnotateSplitRegex = ') '
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
let &cpo = s:save_cpo

View file

@ -67,12 +67,19 @@ let s:hgFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke hg suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the HG executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'HG'
let fullCmd = VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'HG VCSCommand plugin called on non-HG item.'
@ -83,12 +90,17 @@ endfunction
" Function: s:hgFunctions.Identify(buffer) {{{2
function! s:hgFunctions.Identify(buffer)
call system(VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' root')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_INEXACT
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call s:VCSCommandUtility.system(s:Executable() . ' root')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_INEXACT
endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:hgFunctions.Add() {{{2
@ -99,27 +111,23 @@ endfunction
" Function: s:hgFunctions.Annotate(argList) {{{2
function! s:hgFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'HGAnnotate'
if &filetype == 'HGannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ''
let options = ' -un'
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -r' . caption
let options = ' -un -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
set filetype=HGAnnotate
endif
return resultBuffer
return s:DoCommand('blame' . options, 'annotate', caption, {})
endfunction
" Function: s:hgFunctions.Commit(argList) {{{2
@ -163,15 +171,7 @@ function! s:hgFunctions.Diff(argList)
let diffOptions = ['-x -' . hgDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
if hgDiffExt == ''
echomsg 'No differences found'
endif
endif
return resultBuffer
return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
endfunction
" Function: s:hgFunctions.Info(argList) {{{2
@ -188,7 +188,7 @@ endfunction
function! s:hgFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = system(VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' status "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -198,11 +198,11 @@ function! s:hgFunctions.GetBufferInfo()
return ['Unknown']
endif
let parentsText = system(VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' parents "' . fileName . '"')
let [revision] = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1]
let parentsText = s:VCSCommandUtility.system(s:Executable() . ' parents -- "' . fileName . '"')
let revision = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1]
let logText = system(VCSCommandGetOption('VCSCommandHGExec', 'hg') . ' log "' . fileName . '"')
let [repository] = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1]
let logText = s:VCSCommandUtility.system(s:Executable() . ' log -- "' . fileName . '"')
let repository = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1]
if revision == ''
" Error
@ -247,12 +247,7 @@ function! s:hgFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
" let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:hgFunctions.Status(argList) {{{2
@ -269,7 +264,10 @@ function! s:hgFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:hgFunctions.AnnotateSplitRegex = '\d\+: '
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('HG', expand('<sfile>'), s:hgFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('HG', expand('<sfile>'), s:hgFunctions, [])
let &cpo = s:save_cpo

View file

@ -60,12 +60,19 @@ let s:svkFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke SVK suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'SVK'
let fullCmd = VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVK VCSCommand plugin called on non-SVK item.'
@ -82,7 +89,7 @@ function! s:svkFunctions.Identify(buffer)
else
let directoryName = fnamemodify(fileName, ':p:h')
endif
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no")
if(v:shell_error)
return 0
else
@ -98,7 +105,7 @@ endfunction
" Function: s:svkFunctions.Annotate(argList) {{{2
function! s:svkFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'SVKAnnotate'
if &filetype == 'SVKannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
@ -117,7 +124,6 @@ function! s:svkFunctions.Annotate(argList)
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
set filetype=SVKAnnotate
endif
return resultBuffer
endfunction
@ -138,7 +144,7 @@ endfunction
" Function: s:svkFunctions.Diff(argList) {{{2
function! s:svkFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
@ -149,13 +155,7 @@ function! s:svkFunctions.Diff(argList)
let revOptions = a:argList
endif
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
endfunction
" Function: s:svkFunctions.GetBufferInfo() {{{2
@ -167,7 +167,7 @@ endfunction
function! s:svkFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' status -v "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -231,11 +231,7 @@ function! s:svkFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:svkFunctions.Status(argList) {{{2
@ -257,6 +253,6 @@ function! s:svkFunctions.Update(argList)
endfunction
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
let &cpo = s:save_cpo

View file

@ -67,12 +67,19 @@ let s:svnFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'SVN'
let fullCmd = VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' ' . a:cmd
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVN VCSCommand plugin called on non-SVN item.'
@ -109,7 +116,7 @@ endfunction
" Function: s:svnFunctions.Annotate(argList) {{{2
function! s:svnFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'SVNAnnotate'
if &filetype == 'SVNannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
@ -125,11 +132,7 @@ function! s:svnFunctions.Annotate(argList)
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
if resultBuffer > 0
set filetype=SVNAnnotate
endif
return resultBuffer
return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
endfunction
" Function: s:svnFunctions.Commit(argList) {{{2
@ -148,7 +151,7 @@ endfunction
" Function: s:svnFunctions.Diff(argList) {{{2
function! s:svnFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
@ -173,15 +176,7 @@ function! s:svnFunctions.Diff(argList)
let diffOptions = ['-x -' . svnDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
if svnDiffExt == ''
echomsg 'No differences found'
endif
endif
return resultBuffer
return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
endfunction
" Function: s:svnFunctions.GetBufferInfo() {{{2
@ -193,7 +188,7 @@ endfunction
function! s:svnFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status --non-interactive -vu "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -vu -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -257,11 +252,7 @@ function! s:svnFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:svnFunctions.Status(argList) {{{2
@ -287,6 +278,6 @@ endfunction
let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ '
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
let &cpo = s:save_cpo

View file

@ -28,7 +28,7 @@ if exists("b:current_syntax")
endif
syn region gitName start="(\@<=" end="\( \d\d\d\d-\)\@=" contained
syn match gitCommit /^\x\+/ contained
syn match gitCommit /^\^\?\x\+/ contained
syn match gitDate /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d/ contained
syn match gitLineNumber /\d\+)\@=/ contained
syn region gitAnnotation start="^" end=") " oneline keepend contains=gitCommit,gitLineNumber,gitDate,gitName

40
.vim/syntax/hgannotate.vim Executable file
View file

@ -0,0 +1,40 @@
" Vim syntax file
" Language: HG annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2010 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if exists("b:current_syntax")
finish
endif
syn match hgVer /\d\+/ contained
syn match hgName /^\s*\S\+/ contained
syn match hgHead /^\s*\S\+\s\+\d\+:/ contains=hgVer,hgName
if !exists("did_hgannotate_syntax_inits")
let did_hgannotate_syntax_inits = 1
hi link hgName Type
hi link hgVer Statement
endif
let b:current_syntax="hgAnnotate"