1" Vim syntax file 2" Language: po (gettext) 3" Maintainer: Dwayne Bailey <[email protected]> 4" Last Change: 2004 Nov 13 5 6" For version 5.x: Clear all syntax items 7" For version 6.x: Quit when a syntax file was already loaded 8if version < 600 9 syntax clear 10elseif exists("b:current_syntax") 11 finish 12endif 13 14syn sync minlines=10 15 16" Identifiers 17syn match poStatementMsgidplural "^msgid_plural" contained 18syn match poPluralCaseN "[0-9]" contained 19syn match poStatementMsgstr "^msgstr\(\[[0-9]\]\)" contains=poPluralCaseN 20 21" Simple HTML and XML highlighting 22syn match poHtml "<[^<>]\+>" contains=poHtmlTranslatables 23syn match poHtmlNot +"<[^<]\+>"+ms=s+1,me=e-1 24syn region poHtmlTranslatables start=+alt=\\"+ms=e-1 end=+\\"+ contained 25 26" Translation blocks 27syn region poMsgID matchgroup=poStatementMsgid start=+^msgid "+rs=e-1 matchgroup=poStringID end=+^msgstr\(\|\[[\]0\[]\]\) "+me=s-1 contains=poStringID,poStatementMsgidplural,poStatementMsgid 28syn region poMsgSTR matchgroup=poStatementMsgstr start=+^msgstr\(\|\[[\]0\[]\]\) "+rs=e-1 matchgroup=poStringSTR end=+\n\n+me=s-1 contains=poStringSTR,poStatementMsgstr 29syn region poStringID start=+"+ skip=+\\\\\|\\"+ end=+"+ contained 30 \ contains=poSpecial,poFormat,poCommentKDE,poPluralKDE,poKDEdesktopFile,poHtml,poAccelerator,poHtmlNot,poVariable 31syn region poStringSTR start=+"+ skip=+\\\\\|\\"+ end=+"+ contained 32 \ contains=poSpecial,poFormat,poHeaderItem,poCommentKDEError,poHeaderUndefined,poPluralKDEError,poMsguniqError,poKDEdesktopFile,poHtml,poAccelerator,poHtmlNot,poVariable 33 34" Header and Copyright 35syn match poHeaderItem "\(Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|MIME-Version\|Content-Type\|Content-Transfer-Encoding\|Plural-Forms\|X-Generator\): " contained 36syn match poHeaderUndefined "\(PACKAGE VERSION\|YEAR-MO-DA HO:MI+ZONE\|FULL NAME <EMAIL@ADDRESS>\|LANGUAGE <[email protected]>\|text/plain; charset=CHARSET\|ENCODING\)" contained 37syn match poCopyrightUnset "SOME DESCRIPTIVE TITLE\|FIRST AUTHOR <EMAIL@ADDRESS>, YEAR\|Copyright (C) YEAR Free Software Foundation, Inc\|YEAR THE PACKAGE\'S COPYRIGHT HOLDER\|PACKAGE" contained 38 39" Translation comment block including: translator comment, automatic coments, flags and locations 40syn match poComment "^#.*$" 41syn keyword poFlagFuzzy fuzzy contained 42syn match poCommentTranslator "^# .*$" contains=poCopyrightUnset 43syn match poCommentAutomatic "^#\..*$" 44syn match poCommentSources "^#:.*$" 45syn match poCommentFlags "^#,.*$" contains=poFlagFuzzy 46 47" Translations (also includes header fields as they appear in a translation msgstr) 48syn region poCommentKDE start=+"_: +ms=s+1 end="\\n" end="\"\n^msgstr"me=s-1 contained 49syn region poCommentKDEError start=+"\(\|\s\+\)_:+ms=s+1 end="\\n" end=+"\n\n+me=s-1 contained 50syn match poPluralKDE +"_n: +ms=s+1 contained 51syn region poPluralKDEError start=+"\(\|\s\+\)_n:+ms=s+1 end="\"\n\n"me=s-1 contained 52syn match poSpecial contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" 53syn match poFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained 54syn match poFormat "%%" contained 55 56" msguniq and msgcat conflicts 57syn region poMsguniqError matchgroup=poMsguniqErrorMarkers start="#-#-#-#-#" end='#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)\\n' contained 58 59" Obsolete messages 60syn match poObsolete "^#\~.*$" 61 62" KDE Name= handling 63syn match poKDEdesktopFile "\"\(Name\|Comment\|GenericName\|Description\|Keywords\|About\)="ms=s+1,me=e-1 64 65" Accelerator keys - this messes up if the preceding or following char is a multibyte unicode char 66syn match poAccelerator contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 67 68" Variables simple 69syn match poVariable contained "%\d" 70 71" Define the default highlighting. 72" For version 5.7 and earlier: only when not done already 73" For version 5.8 and later: only when an item doesn't have highlighting yet 74if version >= 508 || !exists("did_po_syn_inits") 75 if version < 508 76 let did_po_syn_inits = 1 77 command -nargs=+ HiLink hi link <args> 78 else 79 command -nargs=+ HiLink hi def link <args> 80 endif 81 82 HiLink poCommentSources PreProc 83 HiLink poComment Comment 84 HiLink poCommentAutomatic Comment 85 HiLink poCommentTranslator Comment 86 HiLink poCommentFlags Special 87 HiLink poCopyrightUnset Todo 88 HiLink poFlagFuzzy Todo 89 HiLink poObsolete Comment 90 91 HiLink poStatementMsgid Statement 92 HiLink poStatementMsgstr Statement 93 HiLink poStatementMsgidplural Statement 94 HiLink poPluralCaseN Constant 95 96 HiLink poStringID String 97 HiLink poStringSTR String 98 HiLink poCommentKDE Comment 99 HiLink poCommentKDEError Error 100 HiLink poPluralKDE Comment 101 HiLink poPluralKDEError Error 102 HiLink poHeaderItem Identifier 103 HiLink poHeaderUndefined Todo 104 HiLink poKDEdesktopFile Identifier 105 106 HiLink poHtml Identifier 107 HiLink poHtmlNot String 108 HiLink poHtmlTranslatables String 109 110 HiLink poFormat poSpecial 111 HiLink poSpecial Special 112 HiLink poAccelerator Special 113 HiLink poVariable Special 114 115 HiLink poMsguniqError Special 116 HiLink poMsguniqErrorMarkers Comment 117 118 delcommand HiLink 119endif 120 121let b:current_syntax = "po" 122 123" vim:set ts=8 sts=2 sw=2 noet: 124