Added VCS plugin for vim as well as my "AppleT" clone

git-svn-id: http://photonzero.com/dotfiles/trunk@19 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
michener 2008-04-11 22:08:12 +00:00
parent 4c9de12034
commit a0d94e337a
16 changed files with 3500 additions and 1297 deletions

View file

@ -16,6 +16,7 @@ Darwin)
MACPORTS_PATH=/opt/local/bin:/opt/local/sbin:/opt/local/usr/bin:/opt/local/usr/local/bin; export MACPORTS_PATH
PATH=$HOME/bin:$MACPORTS_PATH:$PATH; export PATH
export DISPLAY=:0.0
set completion-ignore-case on
;;
esac

View file

@ -38,7 +38,7 @@ case $TERM in
*)
TITLEBAR="\033k\033\134";
esac;
PS1="${TITLEBAR}\[\033[0m\]\[\033[0;32m\]\u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[0;32m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0;34m\][\[\033[1;36m\]\w\[\033[0;34m\]]\[\033[0;0m\]\$ "
PS1="\[\033[0m\]\[\033[0;32m\]\u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[0;32m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0;34m\][\[\033[1;36m\]\w\[\033[0;34m\]]\[\033[0;0m\]\$ "
#PS1="${TITLEBAR}\[\033[0m\]\[\033[0;34m\][\[\033[0m\]\[\033[1;33m\]\$(date +%H:%M)|\!\[\033[0m\]\[\033[0;34m\]] \[\033[0m\]\[\033[0;32m\]\u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[0;32m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0m\]\[\033[1;36m\]\w\[\033[0m\]\[\033[0;0m\]\$ "
#PS1="${TITLEBAR}\[\033[0m\]\[\033[1;34m\][\[\033[0m\]\[\033[1;33m\]\$(date +%H:%M)\[\033[0m\]\[\033[1;34m\]] \u\[\033[0m\]\[\033[0;37m\]@\[\033[0m\]\[\033[1;34m\]\h\[\033[0m\]\[\033[0;37m\]:\[\033[0m\]\[\033[1;36m\]\w\[\033[0m\]\[\033[0;0m\]\$ "
#PS1="${TITLEBAR}\[\033[0m\]\[\033[0;32m\][\$(date +%H:%M)] \[\033[0;33m\]\u\[\033[0m\]@\[\033[0;31m\]\h\[\033[1;37m\]:\[\033[0m\]\[\033[1;34m\]\w\[\033[1;37m\]\$ \[\033[0;0m\]"

View file

@ -1 +1,4 @@
winsize 110 43
call AppleTSetPath("~/work/client")
map gg :CmdT

771
.vim/doc/vcscommand.txt Normal file

File diff suppressed because it is too large Load diff

73
.vim/plugin/AppleT.vim Normal file
View file

@ -0,0 +1,73 @@
function! AppleT(name)
python << EOF
import sys
import os
import re
import vim
def walkIt(search):
fullpath = os.path.expanduser(set_path)
fullsearch = ".*%s.*" % ".*".join(search)
fullsearch = re.sub(" ","[/.]", fullsearch)
bsearch = re.sub(" ",".*[/.].*", search)
exactsearch = "%s" % bsearch
exclude = re.compile("\.quer$|\.resp$|\.pyc$")
ignoredirs = [".svn", "_site-packages"]
fullmatch = re.compile(fullsearch, re.I)
exactmatch = re.compile(exactsearch, re.I)
length = len(fullpath)
results = []
exactresults = []
for root, dirs, files in os.walk(set_path):
for x in ignoredirs:
if x in dirs:
dirs.remove(x)
for f in files:
filename = os.path.join(root,f)
if exclude.search(filename):
pass
elif exactmatch.search(filename):
exactresults.append("%s" % filename)
elif fullmatch.search(filename):
results.append("%s" % filename)
if len(results) == 0:
return
def cmplen(x,y):
return cmp(len(x), len(y))
results.sort(cmplen)
exactresults.sort(cmplen)
results = exactresults + results
for i, a in enumerate(results):
print "%d: %s" % (i + 1, a[length:])
which = vim.eval('input("Which? ")')
if re.match("^[0-9]+$", which) == None:
return
which = int(which) - 1
vim.command("tabnew " + results[which])
thingtosearch = vim.eval("expand(a:name)")
walkIt(thingtosearch)
EOF
endfunction
function! AppleTSetPath(path)
python << EOF
import vim
set_path = vim.eval("expand(a:path)")
EOF
endfunction
if !exists(":AppleTSetPath")
command! -nargs=+ AppleTSetPath :call AppleTSetPath(<q-args>)
endif
if !exists(":CmdT")
command! -nargs=+ CmdT :call AppleT(<q-args>)
endif

File diff suppressed because it is too large Load diff

1253
.vim/plugin/vcscommand.vim Normal file

File diff suppressed because it is too large Load diff

437
.vim/plugin/vcscvs.vim Normal file
View file

@ -0,0 +1,437 @@
" vim600: set foldmethod=marker:
"
" CVS extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 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.
"
" Section: Documentation {{{1
"
" Command documentation {{{2
"
" 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
"
" By default, a mapping is defined for each command. User-provided mappings
" can be used instead by mapping to <Plug>CommandName, for instance:
"
" nnoremap ,ce <Plug>CVSEdit
"
" The default mappings are as follow:
"
" <Leader>ce CVSEdit
" <Leader>cE CVSEditors
" <Leader>ct CVSUnedit
" <Leader>cwv CVSWatchers
" <Leader>cwa CVSWatchAdd
" <Leader>cwn CVSWatchOn
" <Leader>cwf CVSWatchOff
" <Leader>cwr CVSWatchRemove
"
" Options documentation: {{{2
"
" VCSCommandCVSExec
" This variable specifies the CVS executable. If not set, it defaults to
" 'cvs' executed from the user's executable path.
"
" VCSCommandCVSDiffOpt
" This variable, if set, determines the options passed to the cvs diff
" command. If not set, it defaults to 'u'.
" Section: Plugin header {{{1
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
" CVS is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:cvsFunctions = {}
" Section: Utility functions {{{1
" 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
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'CVS VCSCommand plugin called on non-CVS item.'
endif
endfunction
" Function: GetRevision() {{{2
" Function for retrieving the current buffer's revision number.
" Returns: Revision number or an empty string if an error occurs.
function! GetRevision()
if !exists('b:VCSCommandBufferInfo')
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
endif
if len(b:VCSCommandBufferInfo) > 0
return b:VCSCommandBufferInfo[0]
else
return ''
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:cvsFunctions.Identify(buffer) {{{2
function! s:cvsFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':h')
endif
if strlen(directoryName) > 0
let CVSRoot = directoryName . '/CVS/Root'
else
let CVSRoot = 'CVS/Root'
endif
if filereadable(CVSRoot)
return 1
else
return 0
endif
endfunction
" Function: s:cvsFunctions.Add(argList) {{{2
function! s:cvsFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:cvsFunctions.Annotate(argList) {{{2
function! s:cvsFunctions.Annotate(argList)
if len(a:argList) == 0
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.]+')
if VCSCommandGetOption('VCSCommandCVSAnnotateParent', 0) != 0
if caption != '1.1'
let revmaj = matchstr(caption,'\v[0-9.]+\ze\.[0-9]+')
let revmin = matchstr(caption,'\v[0-9.]+\.\zs[0-9]+') - 1
if revmin == 0
" Jump to ancestor branch
let caption = matchstr(revmaj,'\v[0-9.]+\ze\.[0-9]+')
else
let caption = revmaj . "." . revmin
endif
endif
endif
let options = ['-r' . caption]
else
" CVS defaults to pulling HEAD, regardless of current branch.
" Therefore, always pass desired revision.
let caption = ''
let options = ['-r' . GetRevision()]
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ['-r' . caption]
else
let caption = join(a:argList)
let options = a:argList
endif
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
return resultBuffer
endfunction
" Function: s:cvsFunctions.Commit(argList) {{{2
function! s:cvsFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
return resultBuffer
endfunction
" Function: s:cvsFunctions.Delete() {{{2
" By default, use the -f option to remove the file first. If options are
" passed in, use those instead.
function! s:cvsFunctions.Delete(argList)
let options = ['-f']
let caption = ''
if len(a:argList) > 0
let options = a:argList
let caption = join(a:argList, ' ')
endif
return s:DoCommand(join(['remove'] + options, ' '), 'delete', caption, {})
endfunction
" Function: s:cvsFunctions.Diff(argList) {{{2
function! s:cvsFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ' -r')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let cvsDiffOpt = VCSCommandGetOption('VCSCommandCVSDiffOpt', 'u')
if cvsDiffOpt == ''
let diffOptions = []
else
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
endfunction
" Function: s:cvsFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin. This CVS extension adds branch name to the return
" list as well.
" Returns: List of results: [revision, repository, branch]
function! s:cvsFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
if isdirectory(fileName)
let tag = ''
if filereadable(fileName . '/CVS/Tag')
let tagFile = readfile(fileName . '/CVS/Tag')
if len(tagFile) == 1
let tag = substitute(tagFile[0], '^T', '', '')
endif
endif
return [tag]
endif
let realFileName = fnamemodify(resolve(fileName), ':t')
if !filereadable(fileName)
return ['Unknown']
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
try
let statusText=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' status "' . realFileName . '"')
if(v:shell_error)
return []
endif
let revision=substitute(statusText, '^\_.*Working revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\)\_.*$', '\1', '')
" We can still be in a CVS-controlled directory without this being a CVS
" file
if match(revision, '^New file!$') >= 0
let revision='New'
elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') <0
return ['Unknown']
endif
let branch=substitute(statusText, '^\_.*Sticky Tag:\s\+\(\d\+\%(\.\d\+\)\+\|\a[A-Za-z0-9-_]*\|(none)\).*$', '\1', '')
let repository=substitute(statusText, '^\_.*Repository revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\|No revision control file\)\_.*$', '\1', '')
let repository=substitute(repository, '^New file!\|No revision control file$', 'New', '')
return [revision, repository, branch]
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:cvsFunctions.Log() {{{2
function! s:cvsFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a: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
endfunction
" Function: s:cvsFunctions.Revert(argList) {{{2
function! s:cvsFunctions.Revert(argList)
return s:DoCommand('update -C', 'revert', '', {})
endfunction
" Function: s:cvsFunctions.Review(argList) {{{2
function! s:cvsFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
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
endfunction
" Function: s:cvsFunctions.Status(argList) {{{2
function! s:cvsFunctions.Status(argList)
return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a:argList, ' '), {})
endfunction
" Function: s:cvsFunctions.Update(argList) {{{2
function! s:cvsFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Section: CVS-specific functions {{{1
" Function: s:CVSEdit() {{{2
function! s:CVSEdit()
return s:DoCommand('edit', 'cvsedit', '', {})
endfunction
" Function: s:CVSEditors() {{{2
function! s:CVSEditors()
return s:DoCommand('editors', 'cvseditors', '', {})
endfunction
" Function: s:CVSUnedit() {{{2
function! s:CVSUnedit()
return s:DoCommand('unedit', 'cvsunedit', '', {})
endfunction
" Function: s:CVSWatch(onoff) {{{2
function! s:CVSWatch(onoff)
if a:onoff !~ '^\c\%(on\|off\|add\|remove\)$'
echoerr 'Argument to CVSWatch must be one of [on|off|add|remove]'
return -1
end
return s:DoCommand('watch ' . tolower(a:onoff), 'cvswatch', '', {})
endfunction
" Function: s:CVSWatchers() {{{2
function! s:CVSWatchers()
return s:DoCommand('watchers', 'cvswatchers', '', {})
endfunction
" Section: Command definitions {{{1
" Section: Primary commands {{{2
com! CVSEdit call s:CVSEdit()
com! CVSEditors call s:CVSEditors()
com! CVSUnedit call s:CVSUnedit()
com! -nargs=1 CVSWatch call s:CVSWatch(<f-args>)
com! CVSWatchAdd call s:CVSWatch('add')
com! CVSWatchOn call s:CVSWatch('on')
com! CVSWatchOff call s:CVSWatch('off')
com! CVSWatchRemove call s:CVSWatch('remove')
com! CVSWatchers call s:CVSWatchers()
" Section: Plugin command mappings {{{1
let s:cvsExtensionMappings = {}
let mappingInfo = [
\['CVSEdit', 'CVSEdit', 'ce'],
\['CVSEditors', 'CVSEditors', 'cE'],
\['CVSUnedit', 'CVSUnedit', 'ct'],
\['CVSWatchers', 'CVSWatchers', 'cwv'],
\['CVSWatchAdd', 'CVSWatch add', 'cwa'],
\['CVSWatchOff', 'CVSWatch off', 'cwf'],
\['CVSWatchOn', 'CVSWatch on', 'cwn'],
\['CVSWatchRemove', 'CVSWatch remove', 'cwr']
\]
for [pluginName, commandText, shortCut] in mappingInfo
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
if !hasmapto('<Plug>' . pluginName)
let s:cvsExtensionMappings[shortCut] = commandText
endif
endfor
" Section: Menu items {{{1
silent! aunmenu Plugin.VCS.CVS
amenu <silent> &Plugin.VCS.CVS.&Edit <Plug>CVSEdit
amenu <silent> &Plugin.VCS.CVS.Ed&itors <Plug>CVSEditors
amenu <silent> &Plugin.VCS.CVS.Unedi&t <Plug>CVSUnedit
amenu <silent> &Plugin.VCS.CVS.&Watchers <Plug>CVSWatchers
amenu <silent> &Plugin.VCS.CVS.WatchAdd <Plug>CVSWatchAdd
amenu <silent> &Plugin.VCS.CVS.WatchOn <Plug>CVSWatchOn
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 &cpo = s:save_cpo

254
.vim/plugin/vcsgit.vim Normal file
View file

@ -0,0 +1,254 @@
" vim600: set foldmethod=marker:
"
" git extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 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.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandGitExec
" This variable specifies the git executable. If not set, it defaults to
" 'git' executed from the user's executable path.
"
" VCSCommandGitDiffOpt
" This variable, if set, determines the default options passed to the
" VCSDiff command. If any options (starting with '-') are passed to the
" command, this variable is not used.
" Section: Plugin header {{{1
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
" git is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:gitFunctions = {}
" Section: Utility functions {{{1
" 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
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'git VCSCommand plugin called on non-git item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:gitFunctions.Identify(buffer) {{{2
" This function only returns an inexact match due to the detection method used
" by git, which simply traverses the directory structure upward.
function! s:gitFunctions.Identify(buffer)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --is-inside-work-tree')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_INEXACT
endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:gitFunctions.Add(argList) {{{2
function! s:gitFunctions.Add(argList)
return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:gitFunctions.Annotate(argList) {{{2
function! s:gitFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'gitAnnotate'
" Perform annotation of the version indicated by the current line.
let options = matchstr(getline('.'),'^\x\+')
else
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let options = a:argList[0]
else
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
endfunction
" Function: s:gitFunctions.Commit(argList) {{{2
function! s:gitFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
return resultBuffer
endfunction
" Function: s:gitFunctions.Delete() {{{2
" All options are passed through.
function! s:gitFunctions.Delete(argList)
let options = a:argList
let caption = join(a:argList, ' ')
return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption, {})
endfunction
" Function: s:gitFunctions.Diff(argList) {{{2
" Pass-through call to git-diff. If no options (starting with '-') are found,
" then the options in the 'VCSCommandGitDiffOpt' variable are added.
function! s:gitFunctions.Diff(argList)
let gitDiffOpt = VCSCommandGetOption('VCSCommandGitDiffOpt', '')
if gitDiffOpt == ''
let diffOptions = []
else
let diffOptions = [gitDiffOpt]
for arg in a:argList
if arg =~ '^-'
let diffOptions = []
break
endif
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
endfunction
" Function: s:gitFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin. This CVS extension adds branch name to the return
" list as well.
" Returns: List of results: [revision, repository, branch]
function! s:gitFunctions.GetBufferInfo()
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
try
let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref -q HEAD'), '\n$', '', '')
if v:shell_error
let branch = 'DETACHED'
else
let branch = substitute(branch, '^refs/heads/', '', '')
endif
let info = [branch]
for method in split(VCSCommandGetOption('VCSCommandGitDescribeArgList', (',tags,all,always')), ',', 1)
if method != ''
let method = ' --' . method
endif
let tag = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' describe' . method), '\n$', '', '')
if !v:shell_error
call add(info, tag)
break
endif
endfor
return info
finally
call VCSCommandChdir(oldCwd)
endtry
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
endfunction
" Function: s:gitFunctions.Revert(argList) {{{2
function! s:gitFunctions.Revert(argList)
return s:DoCommand('checkout', 'revert', '', {})
endfunction
" Function: s:gitFunctions.Review(argList) {{{2
function! s:gitFunctions.Review(argList)
if len(a:argList) == 0
let revision = 'HEAD'
else
let revision = a:argList[0]
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
try
let prefix = system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' 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
endfunction
" Function: s:gitFunctions.Status(argList) {{{2
function! s:gitFunctions.Status(argList)
return s:DoCommand(join(['status'] + a:argList), 'log', join(a:argList), {'allowNonZeroExit': 1})
endfunction
" Function: s:gitFunctions.Update(argList) {{{2
function! s:gitFunctions.Update(argList)
throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know."
endfunction
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
let &cpo = s:save_cpo

258
.vim/plugin/vcssvk.vim Normal file
View file

@ -0,0 +1,258 @@
" vim600: set foldmethod=marker:
"
" SVK extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 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.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandSVKExec
" This variable specifies the SVK executable. If not set, it defaults to
" 'svk' executed from the user's executable path.
" Section: Plugin header {{{1
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
" SVK is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:svkFunctions = {}
" Section: Utility functions {{{1
" 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
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVK VCSCommand plugin called on non-SVK item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:svkFunctions.Identify(buffer) {{{2
function! s:svkFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':p:h')
endif
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
if(v:shell_error)
return 0
else
return 1
endif
endfunction
" Function: s:svkFunctions.Add() {{{2
function! s:svkFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Annotate(argList) {{{2
function! s:svkFunctions.Annotate(argList)
if len(a:argList) == 0
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
else
let caption = ''
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
set filetype=SVKAnnotate
endif
return resultBuffer
endfunction
" Function: s:svkFunctions.Commit(argList) {{{2
function! s:svkFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:svkFunctions.Delete() {{{2
function! s:svkFunctions.Delete(argList)
return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Diff(argList) {{{2
function! s:svkFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a: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
endfunction
" Function: s:svkFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository]
function! s:svkFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' status -v "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under SVK control.
if statusText =~ '^?'
return ['Unknown']
endif
let [flags, revision, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:svkFunctions.Info(argList) {{{2
function! s:svkFunctions.Info(argList)
return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Lock(argList) {{{2
function! s:svkFunctions.Lock(argList)
return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Log() {{{2
function! s:svkFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:svkFunctions.Revert(argList) {{{2
function! s:svkFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:svkFunctions.Review(argList) {{{2
function! s:svkFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
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
endfunction
" Function: s:svkFunctions.Status(argList) {{{2
function! s:svkFunctions.Status(argList)
let options = ['-v']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:svkFunctions.Unlock(argList) {{{2
function! s:svkFunctions.Unlock(argList)
return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Update(argList) {{{2
function! s:svkFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
let &cpo = s:save_cpo

284
.vim/plugin/vcssvn.vim Normal file
View file

@ -0,0 +1,284 @@
" vim600: set foldmethod=marker:
"
" SVN extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 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.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandSVNExec
" This variable specifies the SVN executable. If not set, it defaults to
" 'svn' executed from the user's executable path.
"
" VCSCommandSVNDiffExt
" This variable, if set, sets the external diff program used by Subversion.
"
" VCSCommandSVNDiffOpt
" This variable, if set, determines the options passed to the svn diff
" command (such as 'u', 'w', or 'b').
" Section: Plugin header {{{1
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
" SVN is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:svnFunctions = {}
" Section: Utility functions {{{1
" 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
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVN VCSCommand plugin called on non-SVN item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:svnFunctions.Identify(buffer) {{{2
function! s:svnFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':h')
endif
if strlen(directoryName) > 0
let svnDir = directoryName . '/.svn'
else
let svnDir = '.svn'
endif
if isdirectory(svnDir)
return 1
else
return 0
endif
endfunction
" Function: s:svnFunctions.Add() {{{2
function! s:svnFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Annotate(argList) {{{2
function! s:svnFunctions.Annotate(argList)
if len(a:argList) == 0
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
else
let caption = ''
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -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=SVNAnnotate
endif
return resultBuffer
endfunction
" Function: s:svnFunctions.Commit(argList) {{{2
function! s:svnFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:svnFunctions.Delete() {{{2
function! s:svnFunctions.Delete(argList)
return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Diff(argList) {{{2
function! s:svnFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let svnDiffExt = VCSCommandGetOption('VCSCommandSVNDiffExt', '')
if svnDiffExt == ''
let diffExt = []
else
let diffExt = ['--diff-cmd ' . svnDiffExt]
endif
let svnDiffOpt = VCSCommandGetOption('VCSCommandSVNDiffOpt', '')
if svnDiffOpt == ''
let diffOptions = []
else
let diffOptions = ['-x -' . svnDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
if svnDiffExt == ''
echomsg 'No differences found'
endif
endif
return resultBuffer
endfunction
" Function: s:svnFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository, branch]
function! s:svnFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status -vu "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under SVN control.
if statusText =~ '^?'
return ['Unknown']
endif
let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:svnFunctions.Info(argList) {{{2
function! s:svnFunctions.Info(argList)
return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Lock(argList) {{{2
function! s:svnFunctions.Lock(argList)
return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Log(argList) {{{2
function! s:svnFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:svnFunctions.Revert(argList) {{{2
function! s:svnFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:svnFunctions.Review(argList) {{{2
function! s:svnFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
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
endfunction
" Function: s:svnFunctions.Status(argList) {{{2
function! s:svnFunctions.Status(argList)
let options = ['-u', '-v']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:svnFunctions.Unlock(argList) {{{2
function! s:svnFunctions.Unlock(argList)
return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Update(argList) {{{2
function! s:svnFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Section: Plugin Registration {{{1
call VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
let &cpo = s:save_cpo

View file

@ -0,0 +1,45 @@
" Vim syntax file
" Language: CVS annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the cvscommand plugin. Originally written by Mathieu
" Clabaut
" License:
" Copyright (c) 2007 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 version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn match cvsDate /\d\d-...-\d\d/ contained
syn match cvsName /(\S* /hs=s+1,he=e-1 contained nextgroup=cvsDate
syn match cvsVer /^\d\+\(\.\d\+\)\+/ contained nextgroup=cvsName
syn region cvsHead start="^\d\+\.\d\+" end="):" contains=cvsVer,cvsName,cvsDate
if !exists("did_cvsannotate_syntax_inits")
let did_cvsannotate_syntax_inits = 1
hi link cvsDate Comment
hi link cvsName Type
hi link cvsVer Statement
endif
let b:current_syntax="CVSAnnotate"

View file

@ -0,0 +1,42 @@
" Vim syntax file
" Language: SVK annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2007 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 svkDate /\d\{4}-\d\{1,2}-\d\{1,2}/ skipwhite contained
syn match svkName /(\s*\zs\S\+/ contained nextgroup=svkDate skipwhite
syn match svkVer /^\s*\d\+/ contained nextgroup=svkName skipwhite
syn region svkHead start=/^/ end="):" contains=svkVer,svkName,svkDate oneline
if !exists("did_svkannotate_syntax_inits")
let did_svkannotate_syntax_inits = 1
hi link svkName Type
hi link svkDate Comment
hi link svkVer Statement
endif
let b:current_syntax="svkAnnotate"

View file

@ -0,0 +1,40 @@
" Vim syntax file
" Language: SVN annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2007 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 svnName /\S\+/ contained
syn match svnVer /^\s\+\zs\d\+/ contained nextgroup=svnName skipwhite
syn match svnHead /^\s\+\d\+\s\+\S\+/ contains=svnVer,svnName
if !exists("did_svnannotate_syntax_inits")
let did_svnannotate_syntax_inits = 1
hi link svnName Type
hi link svnVer Statement
endif
let b:current_syntax="svnAnnotate"

31
.vim/syntax/vcscommit.vim Normal file
View file

@ -0,0 +1,31 @@
" Vim syntax file
" Language: VCS commit file
" Maintainer: Bob Hiestand (bob.hiestand@gmail.com)
" License:
" Copyright (c) 2007 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
syntax region vcsComment start="^VCS: " end="$"
highlight link vcsComment Comment
let b:current_syntax = "vcscommit"

10
.vimrc
View file

@ -10,8 +10,10 @@ set smartcase
"Sources
source ~/.vim/supertab.vim
source ~/.vim/charm.vim
source ~/.vim/plugin/AppleT.vim
"source ~/.vim/syntax/motd.vim
au BufNewFile,BufRead motd.public,/tmp/motd.public.r.* setf motd
"Highlighting features
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
@ -23,8 +25,10 @@ set t_Sb=ESC[4%dm
"set t_kb=
"Remappings
nnoremap gn :tabnew<CR>
nnoremap gc :tabclose<CR>
nnoremap gc :tabnew<CR>
nnoremap gK :tabclose<CR>
nnoremap gn gt
nnoremap gp gT
nnoremap j gj
nnoremap k gk
vnoremap j gj
@ -47,4 +51,4 @@ if !exists(":W")
command W :w
endif
inoremap ;a <esc>
"inoremap ;a <esc>