Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: po (gettext) |
| 3 | " Maintainer: Nam SungHyun <namsh@kldp.org> |
| 4 | " Last Change: 2001 Apr 26 |
| 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | syn match poComment "^#.*$" |
| 15 | syn match poSources "^#:.*$" |
| 16 | syn match poStatement "^\(domain\|msgid\|msgstr\)" |
| 17 | syn match poSpecial contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" |
| 18 | syn match poFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained |
| 19 | syn match poFormat "%%" contained |
| 20 | syn region poString start=+"+ skip=+\\\\\|\\"+ end=+"+ |
| 21 | \ contains=poSpecial,poFormat |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 22 | syn region poFuzzy start=+^#,\sfuzzy+ end=+^$+ |
| 23 | syn match poUntranslated +^msgstr\s""\n\n+ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 24 | |
| 25 | " Define the default highlighting. |
| 26 | " For version 5.7 and earlier: only when not done already |
| 27 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 28 | if version >= 508 || !exists("did_po_syn_inits") |
| 29 | if version < 508 |
| 30 | let did_po_syn_inits = 1 |
| 31 | command -nargs=+ HiLink hi link <args> |
| 32 | else |
| 33 | command -nargs=+ HiLink hi def link <args> |
| 34 | endif |
| 35 | |
| 36 | HiLink poComment Comment |
| 37 | HiLink poSources PreProc |
| 38 | HiLink poStatement Statement |
| 39 | HiLink poSpecial Special |
| 40 | HiLink poFormat poSpecial |
| 41 | HiLink poString String |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 42 | HiLink poFuzzy Todo |
| 43 | HiLink poUntranslated Todo |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 44 | |
| 45 | delcommand HiLink |
| 46 | endif |
| 47 | |
| 48 | let b:current_syntax = "po" |
| 49 | |
| 50 | " vim:set ts=8 sts=2 sw=2 noet: |