Bram Moolenaar | 71b6d33 | 2022-09-10 13:13:14 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: git ignore |
| 3 | " Maintainer: ObserverOfTime <chronobserver@disroot.org> |
| 4 | " Filenames: .gitignore, *.git/info/exclude |
| 5 | " Last Change: 2022 Sep 10 |
| 6 | |
| 7 | if exists('b:current_syntax') |
| 8 | finish |
| 9 | endif |
| 10 | |
| 11 | " Comment |
| 12 | syn keyword gitignoreTodo contained TODO FIXME XXX |
| 13 | syn match gitignoreComment /^#.*/ contains=gitignoreTodo |
| 14 | |
| 15 | " Pattern |
| 16 | syn match gitignorePattern /^#\@!.*$/ contains=gitignoreNegation,gitignoreGlob,gitignoreRange,gitignoreSeparator |
| 17 | syn match gitignoreNegation /^!/ contained |
| 18 | syn match gitignoreGlob /\\\@1<![?*]/ contained |
| 19 | syn match gitignoreRange /\\\@1<!\[.\{-}\]/ contained |
| 20 | syn match gitignoreSeparator '/' contained |
| 21 | |
| 22 | hi def link gitignoreComment Comment |
| 23 | hi def link gitignoreGlob Special |
| 24 | hi def link gitignoreNegation SpecialChar |
| 25 | hi def link gitignoreRange Special |
| 26 | hi def link gitignoreSeparator Delimiter |
| 27 | hi def link gitignoreTodo Todo |
| 28 | |
| 29 | let b:current_syntax = 'gitignore' |