Add git support by tpope-git
This commit is contained in:
parent
5bc380150a
commit
3bd6516123
1
build.sh
1
build.sh
@ -67,6 +67,7 @@ syntax 'guns/vim-clojure-static' &
|
|||||||
syntax 'chrisbra/csv.vim' &
|
syntax 'chrisbra/csv.vim' &
|
||||||
syntax 'elixir-lang/vim-elixir' &
|
syntax 'elixir-lang/vim-elixir' &
|
||||||
syntax 'jimenezrick/vimerl' &
|
syntax 'jimenezrick/vimerl' &
|
||||||
|
syntax 'tpope/vim-git' &
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
|
20
ftdetect/git.vim
Normal file
20
ftdetect/git.vim
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
" Git
|
||||||
|
autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,MERGE_}MSG set ft=gitcommit
|
||||||
|
autocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
|
||||||
|
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
|
||||||
|
autocmd BufNewFile,BufRead .msg.[0-9]*
|
||||||
|
\ if getline(1) =~ '^From.*# This line is ignored.$' |
|
||||||
|
\ set ft=gitsendemail |
|
||||||
|
\ endif
|
||||||
|
autocmd BufNewFile,BufRead *.git/**
|
||||||
|
\ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
|
||||||
|
\ set ft=git |
|
||||||
|
\ endif
|
||||||
|
|
||||||
|
" This logic really belongs in scripts.vim
|
||||||
|
autocmd BufNewFile,BufRead,StdinReadPost *
|
||||||
|
\ if getline(1) =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' |
|
||||||
|
\ set ft=git |
|
||||||
|
\ endif
|
38
ftplugin/git.vim
Normal file
38
ftplugin/git.vim
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
" Vim filetype plugin
|
||||||
|
" Language: generic git output
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if (exists("b:did_ftplugin"))
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
if !exists('b:git_dir')
|
||||||
|
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]'
|
||||||
|
" Stay out of the way
|
||||||
|
elseif expand('%:p') =~# '\.git\>'
|
||||||
|
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
|
||||||
|
elseif $GIT_DIR != ''
|
||||||
|
let b:git_dir = $GIT_DIR
|
||||||
|
endif
|
||||||
|
if (has('win32') || has('win64')) && exists('b:git_dir')
|
||||||
|
let b:git_dir = substitute(b:git_dir,'\\','/','g')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
|
||||||
|
if b:git_dir =~# '/\.git$' " Not a bare repository
|
||||||
|
let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path
|
||||||
|
endif
|
||||||
|
let &l:path = escape(b:git_dir,'\, ').','.&l:path
|
||||||
|
let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
|
||||||
|
else
|
||||||
|
setlocal keywordprg=git\ show
|
||||||
|
endif
|
||||||
|
if has('gui_running')
|
||||||
|
let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','')
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
|
||||||
|
let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"
|
67
ftplugin/gitcommit.vim
Normal file
67
ftplugin/gitcommit.vim
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
" Vim filetype plugin
|
||||||
|
" Language: git commit file
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Last Change: 2012 April 7
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if (exists("b:did_ftplugin"))
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! ftplugin/git.vim
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal nomodeline tabstop=8 formatoptions-=croq formatoptions+=tl
|
||||||
|
|
||||||
|
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions<'
|
||||||
|
|
||||||
|
if &textwidth == 0
|
||||||
|
" make sure that log messages play nice with git-log on standard terminals
|
||||||
|
setlocal textwidth=72
|
||||||
|
let b:undo_ftplugin .= "|setl tw<"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("g:no_gitcommit_commands") || v:version < 700
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("b:git_dir")
|
||||||
|
let b:git_dir = expand("%:p:h")
|
||||||
|
endif
|
||||||
|
|
||||||
|
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
|
||||||
|
|
||||||
|
function! s:diffcomplete(A,L,P)
|
||||||
|
let args = ""
|
||||||
|
if a:P <= match(a:L." -- "," -- ")+3
|
||||||
|
let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n"
|
||||||
|
end
|
||||||
|
if exists("b:git_dir") && a:A !~ '^-'
|
||||||
|
let tree = fnamemodify(b:git_dir,':h')
|
||||||
|
if strpart(getcwd(),0,strlen(tree)) == tree
|
||||||
|
let args = args."\n".system("git diff --cached --name-only")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return args
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:gitdiffcached(bang,gitdir,...)
|
||||||
|
let tree = fnamemodify(a:gitdir,':h')
|
||||||
|
let name = tempname()
|
||||||
|
let git = "git"
|
||||||
|
if strpart(getcwd(),0,strlen(tree)) != tree
|
||||||
|
let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
|
||||||
|
endif
|
||||||
|
if a:0
|
||||||
|
let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
|
||||||
|
else
|
||||||
|
let extra = "-p --stat=".&columns
|
||||||
|
endif
|
||||||
|
call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name))
|
||||||
|
exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
|
||||||
|
wincmd P
|
||||||
|
let b:git_dir = a:gitdir
|
||||||
|
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
|
||||||
|
nnoremap <buffer> <silent> q :q<CR>
|
||||||
|
setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
|
||||||
|
endfunction
|
15
ftplugin/gitconfig.vim
Normal file
15
ftplugin/gitconfig.vim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
" Vim filetype plugin
|
||||||
|
" Language: git config file
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Last Change: 2009 Dec 24
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if (exists("b:did_ftplugin"))
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal formatoptions-=t formatoptions+=croql
|
||||||
|
setlocal comments=:#,:; commentstring=;\ %s
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setl fo< com< cms<"
|
43
ftplugin/gitrebase.vim
Normal file
43
ftplugin/gitrebase.vim
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
" Vim filetype plugin
|
||||||
|
" Language: git rebase --interactive
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Last Change: 2010 May 21
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if (exists("b:did_ftplugin"))
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! ftplugin/git.vim
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal comments=:# commentstring=#\ %s formatoptions-=t
|
||||||
|
if !exists("b:undo_ftplugin")
|
||||||
|
let b:undo_ftplugin = ""
|
||||||
|
endif
|
||||||
|
let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo<"
|
||||||
|
|
||||||
|
function! s:choose(word)
|
||||||
|
s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:cycle()
|
||||||
|
call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! -buffer -bar Pick :call s:choose('pick')
|
||||||
|
command! -buffer -bar Squash :call s:choose('squash')
|
||||||
|
command! -buffer -bar Edit :call s:choose('edit')
|
||||||
|
command! -buffer -bar Reword :call s:choose('reword')
|
||||||
|
command! -buffer -bar Fixup :call s:choose('fixup')
|
||||||
|
command! -buffer -bar Cycle :call s:cycle()
|
||||||
|
" The above are more useful when they are mapped; for example:
|
||||||
|
"nnoremap <buffer> <silent> S :Cycle<CR>
|
||||||
|
|
||||||
|
if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
|
||||||
|
|
||||||
|
let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K"
|
6
ftplugin/gitsendemail.vim
Normal file
6
ftplugin/gitsendemail.vim
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
" Vim filetype plugin
|
||||||
|
" Language: git send-email message
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Last Change: 2009 Dec 24
|
||||||
|
|
||||||
|
runtime! ftplugin/mail.vim
|
37
indent/gitconfig.vim
Normal file
37
indent/gitconfig.vim
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
" Vim indent file
|
||||||
|
" Language: git config file
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Last Change: 2012 April 7
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal indentexpr=GetGitconfigIndent()
|
||||||
|
setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
|
||||||
|
|
||||||
|
let b:undo_indent = 'setl ai< inde< indk<'
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetGitconfigIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! GetGitconfigIndent()
|
||||||
|
let line = getline(prevnonblank(v:lnum-1))
|
||||||
|
let cline = getline(v:lnum)
|
||||||
|
if line =~ '\\\@<!\%(\\\\\)*\\$'
|
||||||
|
" odd number of slashes, in a line continuation
|
||||||
|
return 2 * &sw
|
||||||
|
elseif cline =~ '^\s*\['
|
||||||
|
return 0
|
||||||
|
elseif cline =~ '^\s*\a'
|
||||||
|
return &sw
|
||||||
|
elseif cline == '' && line =~ '^\['
|
||||||
|
return &sw
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunction
|
78
syntax/git.vim
Normal file
78
syntax/git.vim
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: generic git output
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Last Change: 2010 May 21
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
syn sync minlines=50
|
||||||
|
|
||||||
|
syn include @gitDiff syntax/diff.vim
|
||||||
|
|
||||||
|
syn region gitHead start=/\%^/ end=/^$/
|
||||||
|
syn region gitHead start=/\%(^commit \x\{40\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
||||||
|
|
||||||
|
" For git reflog and git show ...^{tree}, avoid sync issues
|
||||||
|
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
||||||
|
syn match gitHead /^\x\{40\} \x\{40}\t.*/
|
||||||
|
|
||||||
|
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
|
||||||
|
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff
|
||||||
|
|
||||||
|
syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
|
||||||
|
syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
|
||||||
|
syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
|
||||||
|
syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
|
||||||
|
|
||||||
|
syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
|
||||||
|
syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
|
||||||
|
syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
|
||||||
|
syn match gitMode /^\d\{6\}/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
|
||||||
|
syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||||
|
syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||||
|
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
|
||||||
|
|
||||||
|
syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
|
||||||
|
syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
|
||||||
|
syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
|
||||||
|
|
||||||
|
syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained
|
||||||
|
syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
|
||||||
|
syn match gitDate /\<\d\+ \l\+ ago\>/ contained
|
||||||
|
syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
|
||||||
|
syn match gitStage /\<\d\t\@=/ contained
|
||||||
|
syn match gitReference /\S\+\S\@!/ contained
|
||||||
|
syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage,gitHash skipwhite
|
||||||
|
syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
|
||||||
|
syn match gitHashAbbrev /\<\x\{4,40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
|
||||||
|
syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
|
||||||
|
|
||||||
|
syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
|
||||||
|
syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
|
||||||
|
|
||||||
|
syn match gitNotesHeader /^Notes:\ze\n /
|
||||||
|
|
||||||
|
hi def link gitDateHeader gitIdentityHeader
|
||||||
|
hi def link gitIdentityHeader gitIdentityKeyword
|
||||||
|
hi def link gitIdentityKeyword Label
|
||||||
|
hi def link gitNotesHeader gitKeyword
|
||||||
|
hi def link gitReflogHeader gitKeyword
|
||||||
|
hi def link gitKeyword Keyword
|
||||||
|
hi def link gitIdentity String
|
||||||
|
hi def link gitEmailDelimiter Delimiter
|
||||||
|
hi def link gitEmail Special
|
||||||
|
hi def link gitDate Number
|
||||||
|
hi def link gitMode Number
|
||||||
|
hi def link gitHashAbbrev gitHash
|
||||||
|
hi def link gitHash Identifier
|
||||||
|
hi def link gitReflogMiddle gitReference
|
||||||
|
hi def link gitReference Function
|
||||||
|
hi def link gitStage gitType
|
||||||
|
hi def link gitType Type
|
||||||
|
hi def link gitDiffAdded diffAdded
|
||||||
|
hi def link gitDiffRemoved diffRemoved
|
||||||
|
|
||||||
|
let b:current_syntax = "git"
|
83
syntax/gitcommit.vim
Normal file
83
syntax/gitcommit.vim
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: git commit file
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Filenames: *.git/COMMIT_EDITMSG
|
||||||
|
" Last Change: 2012 April 7
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
syn sync minlines=50
|
||||||
|
|
||||||
|
if has("spell")
|
||||||
|
syn spell toplevel
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn include @gitcommitDiff syntax/diff.vim
|
||||||
|
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
|
||||||
|
|
||||||
|
syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
|
||||||
|
syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
||||||
|
syn match gitcommitOverflow ".*" contained contains=@Spell
|
||||||
|
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
|
||||||
|
syn match gitcommitComment "^#.*"
|
||||||
|
syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent
|
||||||
|
syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
|
||||||
|
syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
|
||||||
|
syn match gitcommitBranch "[^ ']\+" contained
|
||||||
|
syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
|
||||||
|
syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
|
||||||
|
syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
|
||||||
|
syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
|
||||||
|
|
||||||
|
syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
|
||||||
|
syn match gitcommitUntrackedFile "\t\@<=.*" contained
|
||||||
|
|
||||||
|
syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
|
||||||
|
syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
|
||||||
|
syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
|
||||||
|
|
||||||
|
syn match gitcommitDiscardedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
|
||||||
|
syn match gitcommitSelectedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
|
||||||
|
syn match gitcommitUnmergedType "\t\@<=[a-z][a-z ]*[a-z]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
|
||||||
|
syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
|
||||||
|
syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
|
||||||
|
syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
|
||||||
|
syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
|
||||||
|
syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
|
||||||
|
syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile
|
||||||
|
|
||||||
|
syn match gitcommitWarning "\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
|
||||||
|
syn match gitcommitWarning "^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
|
||||||
|
syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
|
||||||
|
|
||||||
|
hi def link gitcommitSummary Keyword
|
||||||
|
hi def link gitcommitComment Comment
|
||||||
|
hi def link gitcommitUntracked gitcommitComment
|
||||||
|
hi def link gitcommitDiscarded gitcommitComment
|
||||||
|
hi def link gitcommitSelected gitcommitComment
|
||||||
|
hi def link gitcommitUnmerged gitcommitComment
|
||||||
|
hi def link gitcommitOnBranch Comment
|
||||||
|
hi def link gitcommitBranch Special
|
||||||
|
hi def link gitcommitNoBranch gitCommitBranch
|
||||||
|
hi def link gitcommitDiscardedType gitcommitType
|
||||||
|
hi def link gitcommitSelectedType gitcommitType
|
||||||
|
hi def link gitcommitUnmergedType gitcommitType
|
||||||
|
hi def link gitcommitType Type
|
||||||
|
hi def link gitcommitNoChanges gitcommitHeader
|
||||||
|
hi def link gitcommitHeader PreProc
|
||||||
|
hi def link gitcommitUntrackedFile gitcommitFile
|
||||||
|
hi def link gitcommitDiscardedFile gitcommitFile
|
||||||
|
hi def link gitcommitSelectedFile gitcommitFile
|
||||||
|
hi def link gitcommitUnmergedFile gitcommitFile
|
||||||
|
hi def link gitcommitFile Constant
|
||||||
|
hi def link gitcommitDiscardedArrow gitcommitArrow
|
||||||
|
hi def link gitcommitSelectedArrow gitcommitArrow
|
||||||
|
hi def link gitcommitUnmergedArrow gitcommitArrow
|
||||||
|
hi def link gitcommitArrow gitcommitComment
|
||||||
|
"hi def link gitcommitOverflow Error
|
||||||
|
hi def link gitcommitBlank Error
|
||||||
|
|
||||||
|
let b:current_syntax = "gitcommit"
|
38
syntax/gitconfig.vim
Normal file
38
syntax/gitconfig.vim
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: git config file
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Filenames: gitconfig, .gitconfig, *.git/config
|
||||||
|
" Last Change: 2010 May 21
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal iskeyword+=-
|
||||||
|
setlocal iskeyword-=_
|
||||||
|
syn case ignore
|
||||||
|
syn sync minlines=10
|
||||||
|
|
||||||
|
syn match gitconfigComment "[#;].*"
|
||||||
|
syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
|
||||||
|
syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
|
||||||
|
syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
|
||||||
|
syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
|
||||||
|
syn keyword gitconfigBoolean true false yes no contained
|
||||||
|
syn match gitconfigNumber "\d\+" contained
|
||||||
|
syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
|
||||||
|
syn match gitconfigError +\\.+ contained
|
||||||
|
syn match gitconfigEscape +\\[\\"ntb]+ contained
|
||||||
|
syn match gitconfigEscape +\\$+ contained
|
||||||
|
|
||||||
|
hi def link gitconfigComment Comment
|
||||||
|
hi def link gitconfigSection Keyword
|
||||||
|
hi def link gitconfigVariable Identifier
|
||||||
|
hi def link gitconfigBoolean Boolean
|
||||||
|
hi def link gitconfigNumber Number
|
||||||
|
hi def link gitconfigString String
|
||||||
|
hi def link gitconfigDelim Delimiter
|
||||||
|
hi def link gitconfigEscape Delimiter
|
||||||
|
hi def link gitconfigError Error
|
||||||
|
|
||||||
|
let b:current_syntax = "gitconfig"
|
38
syntax/gitrebase.vim
Normal file
38
syntax/gitrebase.vim
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: git rebase --interactive
|
||||||
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
|
" Filenames: git-rebase-todo
|
||||||
|
" Last Change: 2012 April 7
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
syn match gitrebaseHash "\v<\x{7,40}>" contained
|
||||||
|
syn match gitrebaseCommit "\v<\x{7,40}>" nextgroup=gitrebaseSummary skipwhite
|
||||||
|
syn match gitrebasePick "\v^p%(ick)=>" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
syn match gitrebaseReword "\v^r%(eword)=>" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite
|
||||||
|
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
|
||||||
|
syn match gitrebaseCommand ".*" contained
|
||||||
|
syn match gitrebaseComment "^#.*" contains=gitrebaseHash
|
||||||
|
syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite
|
||||||
|
|
||||||
|
hi def link gitrebaseCommit gitrebaseHash
|
||||||
|
hi def link gitrebaseHash Identifier
|
||||||
|
hi def link gitrebasePick Statement
|
||||||
|
hi def link gitrebaseReword Number
|
||||||
|
hi def link gitrebaseEdit PreProc
|
||||||
|
hi def link gitrebaseSquash Type
|
||||||
|
hi def link gitrebaseFixup Special
|
||||||
|
hi def link gitrebaseExec Function
|
||||||
|
hi def link gitrebaseSummary String
|
||||||
|
hi def link gitrebaseComment Comment
|
||||||
|
hi def link gitrebaseSquashError Error
|
||||||
|
|
||||||
|
let b:current_syntax = "gitrebase"
|
19
syntax/gitsendemail.vim
Normal file
19
syntax/gitsendemail.vim
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: git send-email message
|
||||||
|
" Maintainer: Tim Pope
|
||||||
|
" Filenames: *.msg.[0-9]* (first line is "From ... # This line is ignored.")
|
||||||
|
" Last Change: 2010 May 21
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! syntax/mail.vim
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
syn match gitsendemailComment "\%^From.*#.*"
|
||||||
|
syn match gitsendemailComment "^GIT:.*"
|
||||||
|
|
||||||
|
hi def link gitsendemailComment Comment
|
||||||
|
|
||||||
|
let b:current_syntax = "gitsendemail"
|
Loading…
x
Reference in New Issue
Block a user