Mercurial > vim
annotate runtime/syntax/po.vim @ 6197:4176c48c7dd5 v7.4.434
updated for version 7.4.434
Problem: gettabvar() is not consistent with getwinvar() and getbufvar().
Solution: Return a dict with all variables when the varname is empty.
(Yasuhiro Matsumoto)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 09 Sep 2014 16:13:08 +0200 |
parents | d1e4abe8342c |
children | 0303182665d5 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: po (gettext) | |
347 | 3 " Maintainer: Dwayne Bailey <dwayne@translate.org.za> |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2587
diff
changeset
|
4 " Last Change: 2012 Apr 30 |
1621 | 5 " Contributors: Dwayne Bailey (Most advanced syntax highlighting) |
6 " Leonardo Fontenelle (Spell checking) | |
2587 | 7 " Nam SungHyun <namsh@kldp.org> (Original maintainer) |
7 | 8 |
9 " For version 5.x: Clear all syntax items | |
10 " For version 6.x: Quit when a syntax file was already loaded | |
11 if version < 600 | |
12 syntax clear | |
13 elseif exists("b:current_syntax") | |
14 finish | |
15 endif | |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2587
diff
changeset
|
16 let s:keepcpo= &cpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2587
diff
changeset
|
17 set cpo&vim |
7 | 18 |
347 | 19 syn sync minlines=10 |
20 | |
21 " Identifiers | |
1621 | 22 syn match poStatementMsgCTxt "^msgctxt" |
347 | 23 syn match poStatementMsgidplural "^msgid_plural" contained |
24 syn match poPluralCaseN "[0-9]" contained | |
25 syn match poStatementMsgstr "^msgstr\(\[[0-9]\]\)" contains=poPluralCaseN | |
26 | |
27 " Simple HTML and XML highlighting | |
1621 | 28 syn match poHtml "<\_[^<>]\+>" contains=poHtmlTranslatables,poLineBreak |
347 | 29 syn match poHtmlNot +"<[^<]\+>"+ms=s+1,me=e-1 |
1621 | 30 syn region poHtmlTranslatables start=+\(abbr\|alt\|content\|summary\|standby\|title\)=\\"+ms=e-1 end=+\\"+ contained contains=@Spell |
31 syn match poLineBreak +"\n"+ contained | |
347 | 32 |
33 " Translation blocks | |
1621 | 34 syn region poMsgCTxt matchgroup=poStatementMsgCTxt start=+^msgctxt "+rs=e-1 matchgroup=poStringCTxt end=+^msgid "+me=s-1 contains=poStringCTxt |
347 | 35 syn region poMsgID matchgroup=poStatementMsgid start=+^msgid "+rs=e-1 matchgroup=poStringID end=+^msgstr\(\|\[[\]0\[]\]\) "+me=s-1 contains=poStringID,poStatementMsgidplural,poStatementMsgid |
36 syn region poMsgSTR matchgroup=poStatementMsgstr start=+^msgstr\(\|\[[\]0\[]\]\) "+rs=e-1 matchgroup=poStringSTR end=+\n\n+me=s-1 contains=poStringSTR,poStatementMsgstr | |
1621 | 37 syn region poStringCTxt start=+"+ skip=+\\\\\|\\"+ end=+"+ |
347 | 38 syn region poStringID start=+"+ skip=+\\\\\|\\"+ end=+"+ contained |
1621 | 39 \ contains=poSpecial,poFormat,poCommentKDE,poPluralKDE,poKDEdesktopFile,poHtml,poAcceleratorId,poHtmlNot,poVariable |
347 | 40 syn region poStringSTR start=+"+ skip=+\\\\\|\\"+ end=+"+ contained |
1621 | 41 \ contains=@Spell,poSpecial,poFormat,poHeaderItem,poCommentKDEError,poHeaderUndefined,poPluralKDEError,poMsguniqError,poKDEdesktopFile,poHtml,poAcceleratorStr,poHtmlNot,poVariable |
347 | 42 |
43 " Header and Copyright | |
2587 | 44 syn 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 |
1621 | 45 syn match poHeaderUndefined "\(PACKAGE VERSION\|YEAR-MO-DA HO:MI+ZONE\|FULL NAME <EMAIL@ADDRESS>\|LANGUAGE <LL@li.org>\|CHARSET\|ENCODING\|INTEGER\|EXPRESSION\)" contained |
347 | 46 syn 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 | |
49 syn match poComment "^#.*$" | |
50 syn keyword poFlagFuzzy fuzzy contained | |
51 syn match poCommentTranslator "^# .*$" contains=poCopyrightUnset | |
52 syn match poCommentAutomatic "^#\..*$" | |
53 syn match poCommentSources "^#:.*$" | |
54 syn match poCommentFlags "^#,.*$" contains=poFlagFuzzy | |
55 | |
56 " Translations (also includes header fields as they appear in a translation msgstr) | |
57 syn region poCommentKDE start=+"_: +ms=s+1 end="\\n" end="\"\n^msgstr"me=s-1 contained | |
58 syn region poCommentKDEError start=+"\(\|\s\+\)_:+ms=s+1 end="\\n" end=+"\n\n+me=s-1 contained | |
59 syn match poPluralKDE +"_n: +ms=s+1 contained | |
60 syn region poPluralKDEError start=+"\(\|\s\+\)_n:+ms=s+1 end="\"\n\n"me=s-1 contained | |
7 | 61 syn match poSpecial contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" |
62 syn match poFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained | |
63 syn match poFormat "%%" contained | |
347 | 64 |
65 " msguniq and msgcat conflicts | |
66 syn region poMsguniqError matchgroup=poMsguniqErrorMarkers start="#-#-#-#-#" end='#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)\\n' contained | |
67 | |
68 " Obsolete messages | |
69 syn match poObsolete "^#\~.*$" | |
70 | |
71 " KDE Name= handling | |
72 syn match poKDEdesktopFile "\"\(Name\|Comment\|GenericName\|Description\|Keywords\|About\)="ms=s+1,me=e-1 | |
73 | |
74 " Accelerator keys - this messes up if the preceding or following char is a multibyte unicode char | |
1621 | 75 syn match poAcceleratorId contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 |
76 syn match poAcceleratorStr contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 contains=@Spell | |
347 | 77 |
78 " Variables simple | |
79 syn match poVariable contained "%\d" | |
7 | 80 |
81 " Define the default highlighting. | |
82 " For version 5.7 and earlier: only when not done already | |
83 " For version 5.8 and later: only when an item doesn't have highlighting yet | |
84 if version >= 508 || !exists("did_po_syn_inits") | |
85 if version < 508 | |
86 let did_po_syn_inits = 1 | |
87 command -nargs=+ HiLink hi link <args> | |
88 else | |
89 command -nargs=+ HiLink hi def link <args> | |
90 endif | |
91 | |
347 | 92 HiLink poCommentSources PreProc |
93 HiLink poComment Comment | |
94 HiLink poCommentAutomatic Comment | |
95 HiLink poCommentTranslator Comment | |
96 HiLink poCommentFlags Special | |
97 HiLink poCopyrightUnset Todo | |
98 HiLink poFlagFuzzy Todo | |
99 HiLink poObsolete Comment | |
100 | |
101 HiLink poStatementMsgid Statement | |
102 HiLink poStatementMsgstr Statement | |
103 HiLink poStatementMsgidplural Statement | |
1621 | 104 HiLink poStatementMsgCTxt Statement |
347 | 105 HiLink poPluralCaseN Constant |
106 | |
1621 | 107 HiLink poStringCTxt Comment |
347 | 108 HiLink poStringID String |
109 HiLink poStringSTR String | |
110 HiLink poCommentKDE Comment | |
111 HiLink poCommentKDEError Error | |
112 HiLink poPluralKDE Comment | |
113 HiLink poPluralKDEError Error | |
114 HiLink poHeaderItem Identifier | |
115 HiLink poHeaderUndefined Todo | |
116 HiLink poKDEdesktopFile Identifier | |
117 | |
118 HiLink poHtml Identifier | |
119 HiLink poHtmlNot String | |
120 HiLink poHtmlTranslatables String | |
1621 | 121 HiLink poLineBreak String |
347 | 122 |
123 HiLink poFormat poSpecial | |
124 HiLink poSpecial Special | |
1621 | 125 HiLink poAcceleratorId Special |
126 HiLink poAcceleratorStr Special | |
127 HiLink poVariable Special | |
347 | 128 |
129 HiLink poMsguniqError Special | |
130 HiLink poMsguniqErrorMarkers Comment | |
7 | 131 |
132 delcommand HiLink | |
133 endif | |
134 | |
135 let b:current_syntax = "po" | |
136 | |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2587
diff
changeset
|
137 let &cpo = s:keepcpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2587
diff
changeset
|
138 unlet s:keepcpo |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
2587
diff
changeset
|
139 |
7 | 140 " vim:set ts=8 sts=2 sw=2 noet: |