26591
|
1 " Vim syntax file
|
|
2 " Language: i3 config file
|
27036
|
3 " Original Author: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
|
|
4 " Maintainer: Quentin Hibon (github user hiqua)
|
26591
|
5 " Version: 0.4
|
28777
|
6 " Last Change: 2022 May 05
|
26591
|
7
|
|
8 " References:
|
|
9 " http://i3wm.org/docs/userguide.html#configuring
|
|
10 " http://vimdoc.sourceforge.net/htmldoc/syntax.html
|
|
11 "
|
|
12 "
|
|
13 " Quit when a syntax file was already loaded
|
|
14 if exists("b:current_syntax")
|
|
15 finish
|
|
16 endif
|
|
17
|
|
18 scriptencoding utf-8
|
|
19
|
|
20 " Error
|
|
21 syn match i3ConfigError /.*/
|
|
22
|
|
23 " Todo
|
|
24 syn keyword i3ConfigTodo TODO FIXME XXX contained
|
|
25
|
|
26 " Comment
|
|
27 " Comments are started with a # and can only be used at the beginning of a line
|
|
28 syn match i3ConfigComment /^\s*#.*$/ contains=i3ConfigTodo
|
|
29
|
|
30 " Font
|
|
31 " A FreeType font description is composed by:
|
|
32 " a font family, a style, a weight, a variant, a stretch and a size.
|
|
33 syn match i3ConfigFontSeparator /,/ contained
|
|
34 syn match i3ConfigFontSeparator /:/ contained
|
|
35 syn keyword i3ConfigFontKeyword font contained
|
|
36 syn match i3ConfigFontNamespace /\w\+:/ contained contains=i3ConfigFontSeparator
|
|
37 syn match i3ConfigFontContent /-\?\w\+\(-\+\|\s\+\|,\)/ contained contains=i3ConfigFontNamespace,i3ConfigFontSeparator,i3ConfigFontKeyword
|
|
38 syn match i3ConfigFontSize /\s\=\d\+\(px\)\?\s\?$/ contained
|
|
39 syn match i3ConfigFont /^\s*font\s\+.*$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
|
|
40 syn match i3ConfigFont /^\s*font\s\+.*\(\\\_.*\)\?$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
|
|
41 syn match i3ConfigFont /^\s*font\s\+.*\(\\\_.*\)\?[^\\]\+$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
|
|
42 syn match i3ConfigFont /^\s*font\s\+\(\(.*\\\_.*\)\|\(.*[^\\]\+$\)\)/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
|
|
43
|
|
44 " variables
|
|
45 syn match i3ConfigString /\(['"]\)\(.\{-}\)\1/ contained
|
|
46 syn match i3ConfigColor /#\w\{6}/ contained
|
|
47 syn match i3ConfigVariableModifier /+/ contained
|
|
48 syn match i3ConfigVariableAndModifier /+\w\+/ contained contains=i3ConfigVariableModifier
|
|
49 syn match i3ConfigVariable /\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?/ contains=i3ConfigVariableModifier,i3ConfigVariableAndModifier
|
|
50 syn keyword i3ConfigInitializeKeyword set contained
|
|
51 syn match i3ConfigInitialize /^\s*set\s\+.*$/ contains=i3ConfigVariable,i3ConfigInitializeKeyword,i3ConfigColor,i3ConfigString
|
|
52
|
28777
|
53 " Include
|
|
54 syn keyword i3ConfigIncludeKeyword include contained
|
|
55 syn match i3ConfigInclude /^\s*include\s\+.*$/ contains=i3ConfigIncludeKeyword,i3ConfigString,i3ConfigVariable
|
|
56
|
26591
|
57 " Gaps
|
|
58 syn keyword i3ConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle up down contained
|
|
59 syn match i3ConfigGapStyle /^\s*\(gaps\)\s\+\(inner\|outer\|horizontal\|vertical\|left\|top\|right\|bottom\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\|toggle\)\)\?\(\s\+\(-\?\d\+\|\$.*\)\)$/ contains=i3ConfigGapStyleKeyword,i3ConfigNumber,i3ConfigVariable
|
|
60 syn keyword i3ConfigSmartGapKeyword on inverse_outer contained
|
|
61 syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\)\s\?$/ contains=i3ConfigSmartGapKeyword
|
|
62 syn keyword i3ConfigSmartBorderKeyword on no_gaps contained
|
|
63 syn match i3ConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\)\s\?$/ contains=i3ConfigSmartBorderKeyword
|
|
64
|
|
65 " Keyboard bindings
|
|
66 syn keyword i3ConfigAction toggle fullscreen restart key import kill shrink grow contained
|
|
67 syn keyword i3ConfigAction focus move grow height width split layout resize restore reload mute unmute exit mode workspace container to contained
|
|
68 syn match i3ConfigModifier /\w\++\w\+\(\(+\w\+\)\+\)\?/ contained contains=i3ConfigVariableModifier
|
|
69 syn match i3ConfigNumber /\s\d\+/ contained
|
|
70 syn match i3ConfigUnit /\sp\(pt\|x\)/ contained
|
|
71 syn match i3ConfigUnitOr /\sor/ contained
|
|
72 syn keyword i3ConfigBindKeyword bindsym bindcode exec gaps border contained
|
|
73 syn match i3ConfigBindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained
|
|
74 syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigNumber,i3ConfigUnit,i3ConfigUnitOr,i3ConfigBindArgument,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword,i3ConfigBorderStyleKeyword
|
|
75
|
|
76 " Floating
|
|
77 syn keyword i3ConfigSizeSpecial x contained
|
|
78 syn match i3ConfigNegativeSize /-/ contained
|
|
79 syn match i3ConfigSize /-\?\d\+\s\?x\s\?-\?\d\+/ contained contains=i3ConfigSizeSpecial,i3ConfigNumber,i3ConfigNegativeSize
|
|
80 syn match i3ConfigFloating /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=i3ConfigVariable
|
|
81 syn match i3ConfigFloating /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=i3ConfigSize
|
|
82
|
|
83 " Orientation
|
|
84 syn keyword i3ConfigOrientationKeyword vertical horizontal auto contained
|
|
85 syn match i3ConfigOrientation /^\s*default_orientation\s\+\(vertical\|horizontal\|auto\)\s\?$/ contains=i3ConfigOrientationKeyword
|
|
86
|
|
87 " Layout
|
|
88 syn keyword i3ConfigLayoutKeyword default stacking tabbed contained
|
|
89 syn match i3ConfigLayout /^\s*workspace_layout\s\+\(default\|stacking\|tabbed\)\s\?$/ contains=i3ConfigLayoutKeyword
|
|
90
|
|
91 " Border style
|
|
92 syn keyword i3ConfigBorderStyleKeyword none normal pixel contained
|
|
93 syn match i3ConfigBorderStyle /^\s*\(new_window\|new_float\|default_border\|default_floating_border\)\s\+\(none\|\(normal\|pixel\)\(\s\+\d\+\)\?\(\s\+\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?\)\?\)\s\?$/ contains=i3ConfigBorderStyleKeyword,i3ConfigNumber,i3ConfigVariable
|
|
94
|
|
95 " Hide borders and edges
|
|
96 syn keyword i3ConfigEdgeKeyword none vertical horizontal both smart smart_no_gaps contained
|
|
97 syn match i3ConfigEdge /^\s*hide_edge_borders\s\+\(none\|vertical\|horizontal\|both\|smart\|smart_no_gaps\)\s\?$/ contains=i3ConfigEdgeKeyword
|
|
98
|
|
99 " Arbitrary commands for specific windows (for_window)
|
|
100 syn keyword i3ConfigCommandKeyword for_window contained
|
|
101 syn region i3ConfigWindowStringSpecial start=+"+ skip=+\\"+ end=+"+ contained contains=i3ConfigString
|
|
102 syn region i3ConfigWindowCommandSpecial start="\[" end="\]" contained contains=i3ConfigWindowStringSpacial,i3ConfigString
|
|
103 syn match i3ConfigArbitraryCommand /^\s*for_window\s\+.*$/ contains=i3ConfigWindowCommandSpecial,i3ConfigCommandKeyword,i3ConfigBorderStyleKeyword,i3ConfigLayoutKeyword,i3ConfigOrientationKeyword,Size,i3ConfigNumber
|
|
104
|
|
105 " Disable focus open opening
|
|
106 syn keyword i3ConfigNoFocusKeyword no_focus contained
|
|
107 syn match i3ConfigDisableFocus /^\s*no_focus\s\+.*$/ contains=i3ConfigWindowCommandSpecial,i3ConfigNoFocusKeyword
|
|
108
|
|
109 " Move client to specific workspace automatically
|
|
110 syn keyword i3ConfigAssignKeyword assign contained
|
|
111 syn match i3ConfigAssignSpecial /→/ contained
|
|
112 syn match i3ConfigAssign /^\s*assign\s\+.*$/ contains=i3ConfigAssignKeyword,i3ConfigWindowCommandSpecial,i3ConfigAssignSpecial
|
|
113
|
|
114 " X resources
|
|
115 syn keyword i3ConfigResourceKeyword set_from_resource contained
|
|
116 syn match i3ConfigResource /^\s*set_from_resource\s\+.*$/ contains=i3ConfigResourceKeyword,i3ConfigWindowCommandSpecial,i3ConfigColor,i3ConfigVariable
|
|
117
|
|
118 " Auto start applications
|
|
119 syn keyword i3ConfigExecKeyword exec exec_always contained
|
|
120 syn match i3ConfigNoStartupId /--no-startup-id/ contained " We are not using i3ConfigBindArgument as only no-startup-id is supported here
|
|
121 syn match i3ConfigExec /^\s*exec\(_always\)\?\s\+.*$/ contains=i3ConfigExecKeyword,i3ConfigNoStartupId,i3ConfigString
|
|
122
|
|
123 " Automatically putting workspaces on specific screens
|
|
124 syn keyword i3ConfigWorkspaceKeyword workspace contained
|
|
125 syn keyword i3ConfigOutput output contained
|
|
126 syn match i3ConfigWorkspace /^\s*workspace\s\+.*$/ contains=i3ConfigWorkspaceKeyword,i3ConfigNumber,i3ConfigString,i3ConfigOutput
|
|
127
|
|
128 " Changing colors
|
|
129 syn keyword i3ConfigClientColorKeyword client focused focused_inactive unfocused urgent placeholder background contained
|
|
130 syn match i3ConfigClientColor /^\s*client.\w\+\s\+.*$/ contains=i3ConfigClientColorKeyword,i3ConfigColor,i3ConfigVariable
|
|
131
|
|
132 syn keyword i3ConfigTitleAlignKeyword left center right contained
|
|
133 syn match i3ConfigTitleAlign /^\s*title_align\s\+.*$/ contains=i3ConfigTitleAlignKeyword
|
|
134
|
|
135 " Interprocess communication
|
|
136 syn match i3ConfigInterprocessKeyword /ipc-socket/ contained
|
|
137 syn match i3ConfigInterprocess /^\s*ipc-socket\s\+.*$/ contains=i3ConfigInterprocessKeyword
|
|
138
|
|
139 " Mouse warping
|
|
140 syn keyword i3ConfigMouseWarpingKeyword mouse_warping contained
|
|
141 syn keyword i3ConfigMouseWarpingType output none contained
|
|
142 syn match i3ConfigMouseWarping /^\s*mouse_warping\s\+\(output\|none\)\s\?$/ contains=i3ConfigMouseWarpingKeyword,i3ConfigMouseWarpingType
|
|
143
|
|
144 " Focus follows mouse
|
|
145 syn keyword i3ConfigFocusFollowsMouseKeyword focus_follows_mouse contained
|
|
146 syn keyword i3ConfigFocusFollowsMouseType yes no contained
|
|
147 syn match i3ConfigFocusFollowsMouse /^\s*focus_follows_mouse\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusFollowsMouseKeyword,i3ConfigFocusFollowsMouseType
|
|
148
|
|
149 " Popups during fullscreen mode
|
|
150 syn keyword i3ConfigPopupOnFullscreenKeyword popup_during_fullscreen contained
|
|
151 syn keyword i3ConfigPopuponFullscreenType smart ignore leave_fullscreen contained
|
|
152 syn match i3ConfigPopupOnFullscreen /^\s*popup_during_fullscreen\s\+\w\+\s\?$/ contains=i3ConfigPopupOnFullscreenKeyword,i3ConfigPopupOnFullscreenType
|
|
153
|
|
154 " Focus wrapping
|
|
155 syn keyword i3ConfigFocusWrappingKeyword force_focus_wrapping focus_wrapping contained
|
|
156 syn keyword i3ConfigFocusWrappingType yes no contained
|
|
157 syn match i3ConfigFocusWrapping /^\s*\(force_\)\?focus_wrapping\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigFocusWrappingKeyword
|
|
158
|
|
159 " Forcing Xinerama
|
|
160 syn keyword i3ConfigForceXineramaKeyword force_xinerama contained
|
|
161 syn match i3ConfigForceXinerama /^\s*force_xinerama\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigForceXineramaKeyword
|
|
162
|
|
163 " Automatic back-and-forth when switching to the current workspace
|
|
164 syn keyword i3ConfigAutomaticSwitchKeyword workspace_auto_back_and_forth contained
|
|
165 syn match i3ConfigAutomaticSwitch /^\s*workspace_auto_back_and_forth\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigAutomaticSwitchKeyword
|
|
166
|
|
167 " Delay urgency hint
|
|
168 syn keyword i3ConfigTimeUnit ms contained
|
|
169 syn keyword i3ConfigDelayUrgencyKeyword force_display_urgency_hint contained
|
|
170 syn match i3ConfigDelayUrgency /^\s*force_display_urgency_hint\s\+\d\+\s\+ms\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigDelayUrgencyKeyword,i3ConfigNumber,i3ConfigTimeUnit
|
|
171
|
|
172 " Focus on window activation
|
|
173 syn keyword i3ConfigFocusOnActivationKeyword focus_on_window_activation contained
|
|
174 syn keyword i3ConfigFocusOnActivationType smart urgent focus none contained
|
|
175 syn match i3ConfigFocusOnActivation /^\s*focus_on_window_activation\s\+\(smart\|urgent\|focus\|none\)\s\?$/ contains=i3ConfigFocusOnActivationKeyword,i3ConfigFocusOnActivationType
|
|
176
|
|
177 " Automatic back-and-forth when switching to the current workspace
|
|
178 syn keyword i3ConfigDrawingMarksKeyword show_marks contained
|
|
179 syn match i3ConfigDrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigDrawingMarksKeyword
|
|
180
|
|
181 " Group mode/bar
|
27162
|
182 syn keyword i3ConfigBlockKeyword mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_min_width workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
|
26591
|
183 syn region i3ConfigBlock start=+.*s\?{$+ end=+^}$+ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
|
|
184
|
|
185 " Line continuation
|
|
186 syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
|
|
187
|
|
188 " Define the highlighting.
|
|
189 hi def link i3ConfigError Error
|
|
190 hi def link i3ConfigTodo Todo
|
|
191 hi def link i3ConfigComment Comment
|
|
192 hi def link i3ConfigFontContent Type
|
|
193 hi def link i3ConfigFocusOnActivationType Type
|
|
194 hi def link i3ConfigPopupOnFullscreenType Type
|
|
195 hi def link i3ConfigOrientationKeyword Type
|
|
196 hi def link i3ConfigMouseWarpingType Type
|
|
197 hi def link i3ConfigFocusFollowsMouseType Type
|
|
198 hi def link i3ConfigGapStyleKeyword Type
|
|
199 hi def link i3ConfigTitleAlignKeyword Type
|
|
200 hi def link i3ConfigSmartGapKeyword Type
|
|
201 hi def link i3ConfigSmartBorderKeyword Type
|
|
202 hi def link i3ConfigLayoutKeyword Type
|
|
203 hi def link i3ConfigBorderStyleKeyword Type
|
|
204 hi def link i3ConfigEdgeKeyword Type
|
|
205 hi def link i3ConfigAction Type
|
|
206 hi def link i3ConfigCommand Type
|
|
207 hi def link i3ConfigOutput Type
|
|
208 hi def link i3ConfigWindowCommandSpecial Type
|
|
209 hi def link i3ConfigFocusWrappingType Type
|
|
210 hi def link i3ConfigUnitOr Type
|
|
211 hi def link i3ConfigFontSize Constant
|
|
212 hi def link i3ConfigColor Constant
|
|
213 hi def link i3ConfigNumber Constant
|
|
214 hi def link i3ConfigUnit Constant
|
|
215 hi def link i3ConfigVariableAndModifier Constant
|
|
216 hi def link i3ConfigTimeUnit Constant
|
|
217 hi def link i3ConfigModifier Constant
|
|
218 hi def link i3ConfigString Constant
|
|
219 hi def link i3ConfigNegativeSize Constant
|
|
220 hi def link i3ConfigFontSeparator Special
|
|
221 hi def link i3ConfigVariableModifier Special
|
|
222 hi def link i3ConfigSizeSpecial Special
|
|
223 hi def link i3ConfigWindowSpecial Special
|
|
224 hi def link i3ConfigAssignSpecial Special
|
|
225 hi def link i3ConfigFontNamespace PreProc
|
|
226 hi def link i3ConfigBindArgument PreProc
|
|
227 hi def link i3ConfigNoStartupId PreProc
|
28777
|
228 hi def link i3ConfigIncludeKeyword Identifier
|
26591
|
229 hi def link i3ConfigFontKeyword Identifier
|
|
230 hi def link i3ConfigBindKeyword Identifier
|
|
231 hi def link i3ConfigOrientation Identifier
|
|
232 hi def link i3ConfigGapStyle Identifier
|
|
233 hi def link i3ConfigTitleAlign Identifier
|
|
234 hi def link i3ConfigSmartGap Identifier
|
|
235 hi def link i3ConfigSmartBorder Identifier
|
|
236 hi def link i3ConfigLayout Identifier
|
|
237 hi def link i3ConfigBorderStyle Identifier
|
|
238 hi def link i3ConfigEdge Identifier
|
|
239 hi def link i3ConfigFloating Identifier
|
|
240 hi def link i3ConfigCommandKeyword Identifier
|
|
241 hi def link i3ConfigNoFocusKeyword Identifier
|
|
242 hi def link i3ConfigInitializeKeyword Identifier
|
|
243 hi def link i3ConfigAssignKeyword Identifier
|
|
244 hi def link i3ConfigResourceKeyword Identifier
|
|
245 hi def link i3ConfigExecKeyword Identifier
|
|
246 hi def link i3ConfigWorkspaceKeyword Identifier
|
|
247 hi def link i3ConfigClientColorKeyword Identifier
|
|
248 hi def link i3ConfigInterprocessKeyword Identifier
|
|
249 hi def link i3ConfigMouseWarpingKeyword Identifier
|
|
250 hi def link i3ConfigFocusFollowsMouseKeyword Identifier
|
|
251 hi def link i3ConfigPopupOnFullscreenKeyword Identifier
|
|
252 hi def link i3ConfigFocusWrappingKeyword Identifier
|
|
253 hi def link i3ConfigForceXineramaKeyword Identifier
|
|
254 hi def link i3ConfigAutomaticSwitchKeyword Identifier
|
|
255 hi def link i3ConfigDelayUrgencyKeyword Identifier
|
|
256 hi def link i3ConfigFocusOnActivationKeyword Identifier
|
|
257 hi def link i3ConfigDrawingMarksKeyword Identifier
|
|
258 hi def link i3ConfigBlockKeyword Identifier
|
|
259 hi def link i3ConfigVariable Statement
|
|
260 hi def link i3ConfigArbitraryCommand Type
|
|
261
|
|
262 let b:current_syntax = "i3config"
|