Bram Moolenaar | 1514667 | 2011-10-20 22:22:38 +0200 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: gitolite configuration |
| 3 | " URL: https://github.com/tmatilai/gitolite.vim |
| 4 | " Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi> |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 5 | " Last Change: 2011-12-25 |
Bram Moolenaar | 1514667 | 2011-10-20 22:22:38 +0200 | [diff] [blame] | 6 | |
| 7 | if exists("b:current_syntax") |
| 8 | finish |
| 9 | endif |
| 10 | |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 11 | let s:cpo_save = &cpo |
| 12 | set cpo&vim |
| 13 | |
Bram Moolenaar | 1514667 | 2011-10-20 22:22:38 +0200 | [diff] [blame] | 14 | " Comment |
| 15 | syn match gitoliteComment "\(^\|\s\)#.*" contains=gitoliteTodo |
| 16 | syn keyword gitoliteTodo TODO FIXME XXX NOT contained |
| 17 | |
| 18 | " Groups, users and repos |
| 19 | syn match gitoliteGroupDef "\(^\s*\)\@<=@[^=]\{-1,}\(\s*=\)\@=" contains=gitoliteSpaceError,gitoliteUserError nextgroup=gitoliteGroupDefSep |
| 20 | syn match gitoliteGroupDefSep "\s*=" contained nextgroup=gitoliteRepoLine |
| 21 | syn match gitoliteRepoDef "^\s*repo\s" nextgroup=gitoliteRepoLine |
| 22 | |
| 23 | syn match gitoliteRepoLine ".*" contained transparent contains=gitoliteGroup,gitoliteWildRepo,gitoliteCreator,gitoliteExtCmdHelper,gitoliteRepoError,gitoliteComment |
| 24 | syn match gitoliteUserLine ".*" contained transparent contains=gitoliteGroup,gitolitePreProc,gitoliteUserError,gitoliteComment |
| 25 | |
Bram Moolenaar | f1568ec | 2011-12-14 21:17:39 +0100 | [diff] [blame] | 26 | syn match gitoliteWildRepo "[ \t=]\@<=[^ \t]*[\\^$|()[\]*?{},][^ \t]*" contained contains=gitoliteCreator,gitoliteRepoError |
Bram Moolenaar | 1514667 | 2011-10-20 22:22:38 +0200 | [diff] [blame] | 27 | syn match gitoliteGroup "[ \t=]\@<=@[^ \t]\+" contained contains=gitoliteUserError |
| 28 | |
| 29 | syn keyword gitoliteCreator CREATER CREATOR contained |
| 30 | syn keyword gitolitePreProc CREATER CREATOR READERS WRITERS contained |
| 31 | |
| 32 | syn match gitoliteExtCmdHelper "[ \t=]\@<=EXTCMD/" contained nextgroup=gitoliteExtCmd |
| 33 | syn match gitoliteExtCmd "rsync\(\s\|$\)" contained |
| 34 | |
| 35 | " Illegal characters |
Bram Moolenaar | f1568ec | 2011-12-14 21:17:39 +0100 | [diff] [blame] | 36 | syn match gitoliteRepoError "[^ \t0-9a-zA-Z._@+/\\^$|()[\]*?{},-]\+" contained |
Bram Moolenaar | 1514667 | 2011-10-20 22:22:38 +0200 | [diff] [blame] | 37 | syn match gitoliteUserError "[^ \t0-9a-zA-Z._@+-]\+" contained |
| 38 | syn match gitoliteSpaceError "\s\+" contained |
| 39 | |
| 40 | " Permission |
| 41 | syn match gitoliteKeyword "^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\)[ \t=]\@=" nextgroup=gitoliteRefex |
| 42 | syn match gitoliteKeyword "^\s*-[ \t=]\@=" nextgroup=gitoliteDenyRefex |
| 43 | syn match gitoliteRefex "[^=]*="he=e-1 contained contains=gitoliteSpecialRefex,gitoliteGroup nextgroup=gitoliteUserLine |
| 44 | syn match gitoliteDenyRefex "[^=]*="he=e-1 contained contains=gitoliteSpecialRefex,gitoliteGroup nextgroup=gitoliteDenyUsers |
| 45 | syn match gitoliteSpecialRefex "\sNAME/"he=e-1 contained |
| 46 | syn match gitoliteSpecialRefex "/USER/"hs=s+1,he=e-1 contained |
| 47 | syn match gitoliteDenyUsers ".*" contained contains=gitoliteUserError,gitoliteComment |
| 48 | |
| 49 | " Configuration |
| 50 | syn match gitoliteKeyword "^\s*config\s\+" nextgroup=gitoliteConfVariable |
| 51 | syn match gitoliteConfVariable "[^=]*" contained |
| 52 | |
| 53 | " Include |
| 54 | syn match gitoliteInclude "^\s*\(include\|subconf\)\s" |
| 55 | |
| 56 | " String |
| 57 | syn region gitoliteString start=+"+ end=+"+ oneline |
| 58 | |
| 59 | " Define the default highlighting |
| 60 | hi def link gitoliteComment Comment |
| 61 | hi def link gitoliteTodo Todo |
| 62 | hi def link gitoliteGroupDef gitoliteGroup |
| 63 | hi def link gitoliteGroup Identifier |
| 64 | hi def link gitoliteWildRepo Special |
| 65 | hi def link gitoliteRepoError gitoliteError |
| 66 | hi def link gitoliteUserError gitoliteError |
| 67 | hi def link gitoliteSpaceError gitoliteError |
| 68 | hi def link gitoliteError Error |
| 69 | hi def link gitoliteCreator gitolitePreProc |
| 70 | hi def link gitolitePreProc PreProc |
| 71 | hi def link gitoliteExtCmdHelper PreProc |
| 72 | hi def link gitoliteExtCmd Special |
| 73 | hi def link gitoliteRepoDef Type |
| 74 | hi def link gitoliteKeyword Keyword |
| 75 | hi def link gitoliteRefex String |
| 76 | hi def link gitoliteDenyRefex gitoliteRefex |
| 77 | hi def link gitoliteSpecialRefex PreProc |
| 78 | hi def link gitoliteDenyUsers WarningMsg |
| 79 | hi def link gitoliteConfVariable Identifier |
| 80 | hi def link gitoliteInclude Include |
| 81 | hi def link gitoliteString String |
| 82 | |
| 83 | let b:current_syntax = "gitolite" |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 84 | |
| 85 | let &cpo = s:cpo_save |
| 86 | unlet s:cpo_save |