Mercurial > vim
comparison runtime/syntax/desktop.vim @ 20856:83cfa1ef1bf2
Update runtime files
Commit: https://github.com/vim/vim/commit/65e0d77a66b7e50beb562ad554ace46c32ef8f0f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 14 17:29:55 2020 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Jun 2020 17:45:04 +0200 |
parents | 46763b01cd9a |
children | 1e91e26ceebf |
comparison
equal
deleted
inserted
replaced
20855:6390b8b611fb | 20856:83cfa1ef1bf2 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: .desktop, .directory files | 2 " Language: XDG desktop entry |
3 " according to freedesktop.org specification 0.9.4 | 3 " Filenames: *.desktop, *.directory |
4 " http://pdx.freedesktop.org/Standards/desktop-entry-spec/desktop-entry-spec-0.9.4.html | 4 " Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com ) |
5 " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) | 5 " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) |
6 " Last Change: 2016 Apr 02 | 6 " Last Change: 2020-06-11 |
7 " (added "Keywords") | 7 " Version Info: desktop.vim 1.5 |
8 " Version Info: desktop.vim 0.9.4-1.2 | 8 " References: |
9 " - https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.5.html (2020-04-27) | |
10 " - https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-0.11.html (2006-02-07) | |
9 | 11 |
10 " quit when a syntax file was already loaded | 12 " quit when a syntax file was already loaded |
11 if exists("b:current_syntax") | 13 if exists("b:current_syntax") |
12 finish | 14 finish |
13 endif | 15 endif |
14 | 16 |
17 let s:cpo_save = &cpo | |
18 set cpo&vim | |
19 syn case match | |
20 | |
21 " Variable {{{1 | |
15 " This syntax file can be used to all *nix configuration files similar to dos | 22 " This syntax file can be used to all *nix configuration files similar to dos |
16 " ini format (eg. .xawtv, .radio, kde rc files) - this is default mode. But | 23 " ini format (eg. .xawtv, .radio, kde rc files) - this is default mode. |
17 " you can also enforce strict following of freedesktop.org standard for | 24 " By default strict following of freedesktop.org standard is enforced. |
18 " .desktop and .directory files . Set (eg. in vimrc) | 25 " To highlight nonstandard extensions that does not begin with X-, set |
19 " let enforce_freedesktop_standard = 1 | 26 " let g:desktop_enable_nonstd = v:true |
20 " and nonstandard extensions not following X- notation will not be highlighted. | 27 " Note that this may cause wrong highlight. |
21 if exists("enforce_freedesktop_standard") | 28 " To highlight KDE-reserved features, set |
22 let b:enforce_freedesktop_standard = 1 | 29 " let g:desktop_enable_kde = v:true |
30 " g:desktop_enable_kde follows g:desktop_enable_nonstd if not supplied | |
31 | |
32 if exists("g:desktop_enable_nonstd") && g:desktop_enable_nonstd | |
33 let s:desktop_enable_nonstd = v:true | |
23 else | 34 else |
24 let b:enforce_freedesktop_standard = 0 | 35 let s:desktop_enable_nonstd = v:false |
25 endif | 36 endif |
26 | 37 |
27 " case on | 38 if exists("g:desktop_enable_kde") && g:desktop_enable_kde || s:desktop_enable_nonstd |
28 syn case match | 39 let s:desktop_enable_kde = v:true |
29 | 40 else |
30 " General | 41 let s:desktop_enable_kde = v:false |
31 if b:enforce_freedesktop_standard == 0 | 42 endif |
32 syn match dtNotStLabel "^.\{-}=\@=" nextgroup=dtDelim | 43 |
33 endif | 44 " Comment {{{1 |
34 | 45 syn match dtComment /^#.*$/ |
35 syn match dtGroup /^\s*\[.*\]/ | 46 |
36 syn match dtComment /^\s*#.*$/ | 47 " Error {{{1 |
37 syn match dtDelim /=/ contained | 48 syn match dtError /\%(^\s.*\|\s\+$\)/ |
38 | 49 |
39 " Locale | 50 " Group Header {{{1 |
40 syn match dtLocale /^\s*\<\(Name\|GenericName\|Comment\|SwallowTitle\|Icon\|UnmountIcon\)\>.*/ contains=dtLocaleKey,dtLocaleName,dtDelim transparent | 51 " ASCII printable characters except for brackets [ (0x5B) and ] (0x5D) |
41 syn keyword dtLocaleKey Name GenericName Comment SwallowTitle Icon UnmountIcon nextgroup=dtLocaleName containedin=dtLocale | 52 syn match dtGroup /^\[[\x20-\x5A\x5C\x5E-\x7E]\+\]$/ |
42 syn match dtLocaleName /\(\[.\{-}\]\s*=\@=\|\)/ nextgroup=dtDelim containedin=dtLocale contained | 53 |
43 | 54 " Entries {{{1 |
44 " Numeric | 55 syn match dtDelim /=/ contained |
45 syn match dtNumeric /^\s*\<Version\>/ contains=dtNumericKey,dtDelim | 56 " lang_territory.codeset@modifier |
46 syn keyword dtNumericKey Version nextgroup=dtDelim containedin=dtNumeric contained | 57 syn match dtLocaleSuffix |
47 | 58 \ /\[\%(C\|POSIX\|[a-z]\{2,4}\%(_[A-Z0-9]\{2,3}\)\?\)\%(\.[A-Za-z0-9_-]\+\)\?\%(@[A-Za-z]\+\)\?\]\ze\s*=/ |
48 " Boolean | 59 \ contained |
49 syn match dtBoolean /^\s*\<\(StartupNotify\|ReadOnly\|Terminal\|Hidden\|NoDisplay\)\>.*/ contains=dtBooleanKey,dtDelim,dtBooleanValue transparent | 60 |
50 syn keyword dtBooleanKey StartupNotify ReadOnly Terminal Hidden NoDisplay nextgroup=dtDelim containedin=dtBoolean contained | 61 " Boolean Value {{{2 |
51 syn keyword dtBooleanValue true false containedin=dtBoolean contained | 62 syn match dtBoolean |
52 | 63 \ /^\%(DBusActivatable\|Hidden\|NoDisplay\|PrefersNonDefaultGPU\|StartupNotify\|Terminal\)\s*=\s*\%(true\|false\)/ |
53 " String | 64 \ contains=dtBooleanKey,dtDelim,dtBooleanValue transparent |
54 syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Keywords\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent | 65 syn keyword dtBooleanKey |
55 syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Keywords Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained | 66 \ DBusActivatable Hidden NoDisplay PrefersNonDefaultGPU StartupNotify Terminal |
56 | 67 \ contained nextgroup=dtDelim |
57 " Exec | 68 |
58 syn match dtExec /^\s*\<\(Exec\|TryExec\|SwallowExec\)\>.*/ contains=dtExecKey,dtDelim,dtExecParam transparent | 69 if s:desktop_enable_kde |
59 syn keyword dtExecKey Exec TryExec SwallowExec nextgroup=dtDelim containedin=dtExec contained | 70 syn match dtBoolean |
60 syn match dtExecParam /%[fFuUnNdDickv]/ containedin=dtExec contained | 71 \ /^ReadOnly\s*=\s*\%(true\|false\)/ |
61 | 72 \ contains=dtBooleanKey,dtDelim,dtBooleanValue transparent |
62 " Type | 73 syn keyword dtBooleanKey |
63 syn match dtType /^\s*\<Type\>.*/ contains=dtTypeKey,dtDelim,dtTypeValue transparent | 74 \ ReadOnly |
64 syn keyword dtTypeKey Type nextgroup=dtDelim containedin=dtType contained | 75 \ contained nextgroup=dtDelim |
65 syn keyword dtTypeValue Application Link FSDevice Directory containedin=dtType contained | 76 endif |
66 | 77 syn keyword dtBooleanValue true false contained |
67 " X-Addition | 78 |
68 syn match dtXAdd /^\s*X-.*/ contains=dtXAddKey,dtDelim transparent | 79 " Numeric Value {{{2 |
69 syn match dtXAddKey /^\s*X-.\{-}\s*=\@=/ nextgroup=dtDelim containedin=dtXAdd contains=dtXLocale contained | 80 " icon theme |
70 | 81 syn match dtNumeric /^\%(MaxSize\|MinSize\|Size\|Threshold\)\s*=\s*\d\+/ contains=dtNumericKey,dtDelim,dtNumericDecimal |
71 " Locale for X-Addition | 82 syn keyword dtNumericKey |
72 syn match dtXLocale /\[.\{-}\]\s*=\@=/ containedin=dtXAddKey contained | 83 \ MaxSize MinSize Size Threshold |
73 | 84 \ contained nextgroup=dtDelim |
74 " Locale for all | 85 |
75 syn match dtALocale /\[.\{-}\]\s*=\@=/ containedin=ALL | 86 if s:desktop_enable_kde |
76 | 87 syn match dtNumeric /^InitialPreference\s*=\s*\d\+/ contains=dtNumericKey,dtDelim,dtNumericDecimal |
77 | 88 syn keyword dtNumericKey |
78 " Define the default highlighting. | 89 \ InitialPreference |
79 " Only when an item doesn't have highlighting yet | 90 \ contained nextgroup=dtDelim |
80 | 91 endif |
81 hi def link dtGroup Special | 92 |
82 hi def link dtComment Comment | 93 syn match dtNumericDecimal /\<\d\+$/ contained |
83 hi def link dtDelim String | 94 |
84 | 95 " String Value {{{2 |
85 hi def link dtLocaleKey Type | 96 syn match dtString |
86 hi def link dtLocaleName Identifier | 97 \ /^\%(Actions\|Implements\|MimeType\|NotShowIn\|OnlyShowIn\|Path\|StartupWMClass\|URL\)\s*=.*\S/ |
87 hi def link dtXLocale Identifier | 98 \ contains=dtStringKey,dtDelim transparent |
88 hi def link dtALocale Identifier | 99 syn keyword dtStringKey |
89 | 100 \ Actions Implements MimeType NotShowIn OnlyShowIn Path StartupWMClass URL Version |
90 hi def link dtNumericKey Type | 101 \ contained nextgroup=dtDelim |
91 | 102 |
92 hi def link dtBooleanKey Type | 103 " icon theme |
93 hi def link dtBooleanValue Constant | 104 syn match dtString |
94 | 105 \ /^\%(Context\|Directories\|Example\|Inherits\)\s*=.*\S/ |
95 hi def link dtStringKey Type | 106 \ contains=dtStringKey,dtDelim transparent |
96 | 107 syn keyword dtStringKey |
97 hi def link dtExecKey Type | 108 \ Context Directories Example Inherits |
98 hi def link dtExecParam Special | 109 \ contained nextgroup=dtDelim |
99 hi def link dtTypeKey Type | 110 |
100 hi def link dtTypeValue Constant | 111 if s:desktop_enable_kde |
101 hi def link dtNotStLabel Type | 112 syn match dtString |
102 hi def link dtXAddKey Type | 113 \ /^\%(Dev\|DocPath\|FSType\|MountPoint\|ServiceTypes\)\s*=.*\S/ |
103 | 114 \ contains=dtStringKey,dtDelim transparent |
104 | 115 syn keyword dtStringKey |
116 \ Dev DocPath FSType MountPoint ServiceTypes | |
117 \ contained nextgroup=dtDelim | |
118 endif | |
119 | |
120 " Categories {{{3 | |
121 " https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry | |
122 syn match dtCategories /^Categories\s*=.\+\S/ contains=dtCategoriesKey,dtDelim,dtCategoriesValue transparent | |
123 syn keyword dtCategoriesKey | |
124 \ Categories | |
125 \ contained nextgroup=dtDelim | |
126 | |
127 " Main Categories | |
128 syn keyword dtCategoriesValue | |
129 \ Audio AudioVideo Development Education Game Graphics Network Office | |
130 \ Settings System Utility Video | |
131 \ contained | |
132 | |
133 " Additional Categories | |
134 syn keyword dtCategoriesValue | |
135 \ BoardGame Chat Clock Geoscience Presentation 2DGraphics 3DGraphics | |
136 \ Accessibility ActionGame AdventureGame Amusement ArcadeGame Archiving | |
137 \ Art ArtificialIntelligence Astronomy AudioVideoEditing Biology | |
138 \ BlocksGame BoardGame Building Calculator Calendar CardGame Chart Chat | |
139 \ Chemistry Clock Compression ComputerScience ConsoleOnly Construction | |
140 \ ContactManagement Core DataVisualization Database Debugger | |
141 \ DesktopSettings Dialup Dictionary DiscBurning Documentation Economy | |
142 \ Electricity Electronics Email Emulator Engineering FileManager | |
143 \ FileTools FileTransfer Filesystem Finance FlowChart GNOME GTK | |
144 \ GUIDesigner Geography Geology Geoscience HamRadio HardwareSettings | |
145 \ History IDE IRCClient ImageProcessing InstantMessaging Java KDE | |
146 \ KidsGame Languages Literature LogicGame Math MedicalSoftware Midi | |
147 \ Mixer Monitor Motif Music News NumericalAnalysis OCR P2P PDA | |
148 \ PackageManager ParallelComputing Photography Physics Player | |
149 \ Presentation Printing Profiling ProjectManagement Publishing Qt | |
150 \ RasterGraphics Recorder RemoteAccess RevisionControl Robotics | |
151 \ RolePlaying Scanning Science Security Sequencer Simulation Sports | |
152 \ SportsGame Spreadsheet StrategyGame TV Telephony TelephonyTools | |
153 \ TerminalEmulator TextEditor TextTools Translation Tuner VectorGraphics | |
154 \ VideoConference Viewer WebBrowser WebDevelopment WordProcessor | |
155 \ contained | |
156 | |
157 " Reserved Category | |
158 syn keyword dtCategoriesValue | |
159 \ Applet Screensaver Shell TrayIcon | |
160 \ contained | |
161 | |
162 " Exec/TryExec {{{3 | |
163 syn match dtExec /^\%(Exec\|TryExec\)\s*=.\+\S/ contains=dtExecKey,dtDelim,dtExecParam transparent | |
164 syn keyword dtExecKey | |
165 \ Exec TryExec | |
166 \ contained nextgroup=dtDelim | |
167 " code for file(s), URL(s), etc | |
168 syn match dtExecParam /\s\zs%[fFuUick]\ze\%(\W\|$\)/ contained | |
169 | |
170 " Type {{{3 | |
171 syn match dtType /^Type\s*=\s*\S\+/ contains=dtTypeKey,dtDelim,dtTypeValue transparent | |
172 syn keyword dtTypeKey | |
173 \ Type | |
174 \ contained nextgroup=dtDelim | |
175 syn keyword dtTypeValue | |
176 \ Application Directory Link | |
177 \ contained | |
178 | |
179 if s:desktop_enable_kde | |
180 syn keyword dtTypeValue | |
181 \ FSDevice Service ServiceType | |
182 \ contained | |
183 endif | |
184 | |
185 | |
186 " Version {{{3 | |
187 syn match dtVersion /^Version\s*=\s*\S\+/ contains=dtVersionKey,dtDelim,dtVersionValue transparent | |
188 syn keyword dtVersionKey | |
189 \ Version | |
190 \ contained nextgroup=dtDelim | |
191 syn match dtVersionValue /[0-9]\+\%(\.[0-9]\+\)\{1,2}$/ contained | |
192 | |
193 " Localestring Value {{{2 | |
194 syn match dtLocalestring | |
195 \ /^\%(Comment\|GenericName\|Keywords\|Name\)\%(\[.\{-}\]\)\?\s*=.*\S/ | |
196 \ contains=dtLocalestringKey,dtLocaleSuffix,dtDelim transparent | |
197 syn keyword dtLocalestringKey | |
198 \ Comment GenericName Keywords Name | |
199 \ contained nextgroup=dtLocaleSuffix,dtDelim skipwhite | |
200 | |
201 " Iconstring Value {{{2 | |
202 syn match dtIconstring | |
203 \ /^Icon\s*=.*\S/ | |
204 \ contains=dtIconstringKey,dtDelim transparent | |
205 syn keyword dtIconstringKey | |
206 \ Icon | |
207 \ contained nextgroup=dtDelim skipwhite | |
208 | |
209 if s:desktop_enable_kde | |
210 syn match dtIconstring | |
211 \ /^UnmountIcon\>\%(\[.\{-}\]\)\?\s*=.*\S/ | |
212 \ contains=dtIconstringKey,dtLocaleSuffix,dtDelim transparent | |
213 syn keyword dtIconstringKey | |
214 \ UnmountIcon | |
215 \ contained nextgroup=dtLocaleSuffix,dtDelim skipwhite | |
216 endif | |
217 | |
218 " X-Extension {{{2 | |
219 syn match dtXExtension /^X-[0-9A-Za-z-]*\%(\[.\{-}\]\)\?\s*=.*\S/ | |
220 \ contains=dtXExtensionKey,dtLocaleSuffix,dtDelim transparent | |
221 syn match dtXExtensionKey /^X-[0-9A-Za-z-]*/ contained nextgroup=dtLocaleSuffix,dtDelim | |
222 | |
223 " non standard {{{2 | |
224 if s:desktop_enable_nonstd | |
225 syn match dtNonStdLabel /^[0-9A-Za-z-]\+\%(\[.\{-}\]\)\?\s*=.*\S/ | |
226 \ contains=dtNonStdLabelKey,dtLocaleSuffix,dtDelim transparent | |
227 syn match dtNonStdLabelKey /^[0-9A-Za-z-]\+/ contained nextgroup=dtLocaleSuffix,dtDelim | |
228 endif | |
229 | |
230 " Highlight {{{1 | |
231 hi def link dtComment Comment | |
232 hi def link dtError Error | |
233 | |
234 hi def link dtGroup Special | |
235 | |
236 hi def link dtDelim Delimiter | |
237 hi def link dtLocaleSuffix Identifier | |
238 | |
239 hi def link dtBooleanKey Type | |
240 hi def link dtBooleanValue Boolean | |
241 | |
242 hi def link dtNumericKey Type | |
243 hi def link dtNumericDecimal Number | |
244 | |
245 hi def link dtStringKey Type | |
246 hi def link dtCategoriesKey Type | |
247 hi def link dtCategoriesValue Constant | |
248 hi def link dtExecKey Type | |
249 hi def link dtExecParam Special | |
250 hi def link dtTypeKey Type | |
251 hi def link dtTypeValue Constant | |
252 hi def link dtVersionKey Type | |
253 hi def link dtVersionValue Constant | |
254 | |
255 hi def link dtLocalestringKey Type | |
256 | |
257 hi def link dtIconStringKey Type | |
258 | |
259 hi def link dtXExtensionKey Type | |
260 | |
261 hi def link dtNonStdLabelKey Type | |
262 | |
263 " Clean Up {{{1 | |
105 let b:current_syntax = "desktop" | 264 let b:current_syntax = "desktop" |
106 | 265 let &cpo = s:cpo_save |
107 " vim:ts=8 | 266 |
267 " vim:ts=8:sw=2:fdm=marker |