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