summaryrefslogtreecommitdiffstats
path: root/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'syntax')
-rw-r--r--syntax/i3.vim138
-rw-r--r--syntax/i3config.vim246
2 files changed, 246 insertions, 138 deletions
diff --git a/syntax/i3.vim b/syntax/i3.vim
deleted file mode 100644
index 45bf846e..00000000
--- a/syntax/i3.vim
+++ /dev/null
@@ -1,138 +0,0 @@
-if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1
-
-" Vim syntax file
-" Language: i3-wm config file
-" Maintainer: Emanuel Guével
-" Latest Revision: 16 October 2012
-
-if exists("b:current_syntax")
- finish
-endif
-
-" Symbols
-syn match i3Operators "+\|→"
-syn match i3ChainDelimiter ";"
-
-syn match i3Var "\$\w\+"
-
-" Key modifiers
-syn keyword i3KeyModifier Shift Control Ctrl Mod1 Mod2 Mod3 Mod4 Mod5 Mode_switch
-
-" Strings
-syn region i3SimpleString keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var
-syn match i3QuotedString '"[^"]\+"' contained
-syn cluster i3String contains=i3SimpleString,i3QuotedString
-
-" Config commands
-syn keyword i3ConfigCommand bind bindcode bindsym assign new_window popup_during_fullscreen font floating_modifier default_orientation workspace_layout for_window focus_follows_mouse bar position colors output tray_output workspace_buttons workspace_auto_back_and_forth binding_mode_indicator debuglog floating_minimum_size floating_maximum_size force_focus_wrapping force_xinerama force_display_urgency_hint hidden_state modifier new_float shmlog socket_path verbose mouse_warping strip_workspace_numbers focus_on_window_activation no_focus
-syn match i3IpcSocket "ipc[-_]socket" nextgroup=@i3String skipwhite
-
-" Command keywords
-syn keyword i3Command exit reload restart kill fullscreen global layout border focus move open split append_layout mark unmark resize grow shrink show nop rename title_format sticky
-syn keyword i3Param 1pixel default stacked tabbed normal none tiling stacking floating enable disable up down horizontal vertical auto up down left right parent child px or ppt leave_fullscreen toggle mode_toggle scratchpad width height top bottom client hide primary yes all active window container to absolute center on off x ms h v smart ignore pixel splith splitv output true
-syn match i3DashedParam '--\(release\|border\|whole-window\|toggle\)' skipwhite
-syn match i3NoStartupId '--no-startup-id' contained
-syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number
-syn keyword i3BordersSpecialParam none vertical horizontal both
-syn keyword i3ModeParam dock hide invisible skipwhite
-syn keyword i3GapsCommand gaps smart_gaps smart_borders
-syn keyword i3GapsParam inner outer current all set plus minus no_gaps
-
-" these are not keywords but we add them for consistency
-syn keyword i3PseudoParam no false inactive
-
-" Exec commands
-syn region i3ExecCommand keepend start='[^ \t]' end='$\|;' contained contains=i3ChainDelimiter,i3Var,i3NoStartupId
-syn match i3QuotedExecCommand '"[^"]\+"' contained
-syn keyword i3ExecKeyword exec exec_always i3bar_command nextgroup=i3QuotedExecCommand,i3ExecCommand skipwhite
-
-" Status command
-syn match i3StatusCommand ".*$" contained
-syn keyword i3StatusCommandKeyword status_command nextgroup=i3StatusCommand skipwhite
-
-" Font statement
-syn keyword i3FontStatement font nextgroup=@i3String skipwhite
-
-" Separator symbol
-syn keyword i3SeparatorSymbol separator_symbol nextgroup=@i3String skipwhite
-
-" Set statement
-syn match i3SetVar "\$\w\+" contained nextgroup=@i3String skipwhite
-syn keyword i3SetKeyword set set_from_resource nextgroup=i3SetVar skipwhite
-
-" Workspaces
-syn keyword i3WsKeyword workspace nextgroup=i3WsSpecialParam,@i3String skipwhite
-
-" Hide edge borders
-syn keyword i3BordersConfigCommand hide_edge_borders nextgroup=i3BordersSpecialParam skipwhite
-
-" Mode
-syn keyword i3ModeKeyword mode nextgroup=i3ModeParam,@i3String skipwhite
-
-" Comments
-syn keyword i3Todo contained TODO FIXME XXX NOTE
-syn match i3Comment "^\s*#.*$" contains=i3Todo
-
-" Error (at end of line)
-syn match i3Error ".*$" contained
-
-" Hex color code
-syn match i3ColorLast "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Error skipwhite
-syn match i3Color2nd "#[0-9a-fA-F]\{6\}" contained nextgroup=i3ColorLast skipwhite
-syn match i3Color1st "#[0-9a-fA-F]\{6\}" contained nextgroup=i3Color2nd skipwhite
-
-syn match i3ColorDef1 "client\.background\|statusline\|background\|separator\|statusline" nextgroup=i3ColorLast skipwhite
-syn match i3ColorDef3 "client\.\(focused_inactive\|focused\|unfocused\|urgent\)\|inactive_workspace\|urgent_workspace\|focused_workspace\|active_workspace" nextgroup=i3Color1st skipwhite
-
-highlight link i3ChainDelimiter Operator
-highlight link i3Operators Operator
-
-highlight link i3ExecCommand Special
-highlight link i3QuotedExecCommand Special
-highlight link i3StatusCommand Special
-
-highlight link i3Param Constant
-highlight link i3PseudoParam Constant
-highlight link i3DashedParam Constant
-highlight link i3NoStartupId Constant
-highlight link i3Color1st Constant
-highlight link i3Color2nd Constant
-highlight link i3ColorLast Constant
-highlight link i3WsSpecialParam Constant
-highlight link i3BordersSpecialParam Constant
-highlight link i3ModeParam Constant
-highlight link i3GapsParam Constant
-
-highlight link i3Var Identifier
-highlight link i3SetVar Identifier
-
-highlight link i3KeyModifier Function
-
-highlight link i3SimpleString String
-highlight link i3QuotedString String
-highlight link i3WsName String
-highlight link i3QuotedWsName String
-highlight link i3SetValue String
-highlight link i3Font String
-
-highlight link i3ExecKeyword Keyword
-highlight link i3Command Keyword
-highlight link i3WsKeyword Keyword
-highlight link i3GapsCommand Keyword
-
-highlight link i3ColorDef1 Define
-highlight link i3ColorDef3 Define
-highlight link i3ConfigCommand Define
-highlight link i3IpcSocket Define
-highlight link i3SetKeyword Define
-highlight link i3ModeKeyword Define
-highlight link i3FontStatement Define
-highlight link i3SeparatorSymbol Define
-highlight link i3StatusCommandKeyword Define
-highlight link i3BordersConfigCommand Define
-
-highlight link i3Todo Todo
-highlight link i3Comment Comment
-highlight link i3Error Error
-
-endif
diff --git a/syntax/i3config.vim b/syntax/i3config.vim
new file mode 100644
index 00000000..1d6367f2
--- /dev/null
+++ b/syntax/i3config.vim
@@ -0,0 +1,246 @@
+if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'i3') == -1
+
+" Vim syntax file
+" Language: i3 config file
+" Maintainer: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
+" Version: 0.3
+" Last Change: 2017-10-27 23:59
+
+" References:
+" http://i3wm.org/docs/userguide.html#configuring
+" http://vimdoc.sourceforge.net/htmldoc/syntax.html
+"
+"
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syn clear
+elsei exists("b:current_syntax")
+ fini
+en
+
+scriptencoding utf-8
+
+" Error
+syn match Error /.*/
+
+" Todo
+syn keyword Todo TODO FIXME XXX contained
+
+" Comment
+" Comments are started with a # and can only be used at the beginning of a line
+syn match Comment /^\s*#.*$/ contains=Todo
+
+" Font
+" A FreeType font description is composed by:
+" a font family, a style, a weight, a variant, a stretch and a size.
+syn match FontSeparator /,/ contained
+syn match FontSeparator /:/ contained
+syn keyword FontKeyword font contained
+syn match FontNamespace /\w\+:/ contained contains=FontSeparator
+syn match FontContent /-\?\w\+\(-\+\|\s\+\|,\)/ contained contains=FontNamespace,FontSeparator,FontKeyword
+syn match FontSize /\s\=\d\+\(px\)\?\s\?$/ contained
+syn match Font /^\s*font\s\+.*$/ contains=FontContent,FontSeparator,FontSize,FontNamespace
+"syn match Font /^\s*font\s\+.*\(\\\_.*\)\?$/ contains=FontContent,FontSeparator,FontSize,FontNamespace
+"syn match Font /^\s*font\s\+.*\(\\\_.*\)\?[^\\]\+$/ contains=FontContent,FontSeparator,FontSize,FontNamespace
+"syn match Font /^\s*font\s\+\(\(.*\\\_.*\)\|\(.*[^\\]\+$\)\)/ contains=FontContent,FontSeparator,FontSize,FontNamespace
+
+" variables
+syn match String /\(['"]\)\(.\{-}\)\1/ contained
+syn match Color /#\w\{6}/ contained
+syn match VariableModifier /+/ contained
+syn match VariableAndModifier /+\w\+/ contained contains=VariableModifier
+syn match Variable /\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?/ contains=VariableModifier,VariableAndModifier
+syn keyword InitializeKeyword set contained
+syn match Initialize /^\s*set\s\+.*$/ contains=Variable,InitializeKeyword,Color,String
+
+" Gaps
+syn keyword GapStyleKeyword inner outer current all set plus minus contained
+syn match GapStyle /^\s*\(gaps\)\s\+\(inner\|outer\)\(\s\+\(current\|all\)\)\?\(\s\+\(set\|plus\|minus\)\)\?\(\s\+\d\+\)$/ contains=GapStyleKeyword,number
+
+" Keyboard bindings
+syn keyword Action toggle fullscreen restart key import kill shrink grow contained
+syn keyword Action focus move split layout resize restore reload mute unmute exit contained
+syn match Modifier /\w\++\w\+\(\(+\w\+\)\+\)\?/ contained contains=VariableModifier
+syn match Number /\s\d\+/ contained
+syn keyword BindKeyword bindsym bindcode exec gaps contained
+syn match BindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained
+syn match Bind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=Variable,BindKeyword,VariableAndModifier,BindArgument,Number,Modifier,Action,String,GapStyleKeyword
+
+" Floating
+syn keyword SizeSpecial x contained
+syn match NegativeSize /-/ contained
+syn match Size /-\?\d\+\s\?x\s\?-\?\d\+/ contained contains=SizeSpecial,Number,NegativeSize
+syn match Floating /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=Variable
+syn match Floating /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=Size
+
+" Orientation
+syn keyword OrientationKeyword vertical horizontal auto contained
+syn match Orientation /^\s*default_orientation\s\+\(vertical\|horizontal\|auto\)\s\?$/ contains=OrientationKeyword
+
+" Layout
+syn keyword LayoutKeyword default stacking tabbed contained
+syn match Layout /^\s*workspace_layout\s\+\(default\|stacking\|tabbed\)\s\?$/ contains=LayoutKeyword
+
+" Border style
+syn keyword BorderStyleKeyword none normal pixel contained
+syn match BorderStyle /^\s*\(new_window\|new_float\|default_border\|default_floating_border\)\s\+\(none\|\(normal\|pixel\)\(\s\+\d\+\)\?\)\s\?$/ contains=BorderStyleKeyword,number
+
+" Hide borders and edges
+syn keyword EdgeKeyword none vertical horizontal both contained
+syn match Edge /^\s*hide_edge_borders\s\+\(none\|vertical\|horizontal\|both\)\s\?$/ contains=EdgeKeyword
+
+" Arbitrary commands for specific windows (for_window)
+syn keyword CommandKeyword for_window contained
+syn region WindowStringSpecial start=+"+ skip=+\\"+ end=+"+ contained contains=String
+syn region WindowCommandSpecial start="\[" end="\]" contained contains=WindowStringSpacial,String
+syn match ArbitraryCommand /^\s*for_window\s\+.*$/ contains=WindowCommandSpecial,CommandKeyword,BorderStyleKeyword,LayoutKeyword,OrientationKeyword,Size,Number
+
+" Disable focus open opening
+syn keyword NoFocusKeyword no_focus contained
+syn match DisableFocus /^\s*no_focus\s\+.*$/ contains=WindowCommandSpecial,NoFocusKeyword
+
+" Move client to specific workspace automatically
+syn keyword AssignKeyword assign contained
+syn match AssignSpecial /→/ contained
+syn match Assign /^\s*assign\s\+.*$/ contains=AssignKeyword,WindowCommandSpecial,AssignSpecial
+
+" X resources
+syn keyword ResourceKeyword set_from_resource contained
+syn match Resource /^\s*set_from_resource\s\+.*$/ contains=ResourceKeyword,WindowCommandSpecial,Color,Variable
+
+" Auto start applications
+syn keyword ExecKeyword exec exec_always contained
+syn match NoStartupId /--no-startup-id/ contained " We are not using BindArgument as only no-startup-id is supported here
+syn match Exec /^\s*exec\(_always\)\?\s\+.*$/ contains=ExecKeyword,NoStartupId,String
+
+" Automatically putting workspaces on specific screens
+syn keyword WorkspaceKeyword workspace contained
+syn keyword Output output contained
+syn match Workspace /^\s*workspace\s\+.*$/ contains=WorkspaceKeyword,Number,String,Output
+
+" Changing colors
+syn keyword ClientColorKeyword client focused focused_inactive unfocused urgent placeholder background contained
+syn match ClientColor /^\s*client.\w\+\s\+.*$/ contains=ClientColorKeyword,Color,Variable
+
+" Interprocess communication
+syn match InterprocessKeyword /ipc-socket/ contained
+syn match Interprocess /^\s*ipc-socket\s\+.*$/ contains=InterprocessKeyword
+
+" Mouse warping
+syn keyword MouseWarpingKeyword mouse_warping contained
+syn keyword MouseWarpingType output none contained
+syn match MouseWarping /^\s*mouse_warping\s\+\(output\|none\)\s\?$/ contains=MouseWarpingKeyword,MouseWarpingType
+
+" Focus follows mouse
+syn keyword FocusFollowsMouseKeyword focus_follows_mouse contained
+syn keyword FocusFollowsMouseType yes no contained
+syn match FocusFollowsMouse /^\s*focus_follows_mouse\s\+\(yes\|no\)\s\?$/ contains=FocusFollowsMouseKeyword,FocusFollowsMouseType
+
+" Popups during fullscreen mode
+syn keyword PopupOnFullscreenKeyword popup_during_fullscreen contained
+syn keyword PopuponFullscreenType smart ignore leave_fullscreen contained
+syn match PopupOnFullscreen /^\s*popup_during_fullscreen\s\+\w\+\s\?$/ contains=PopupOnFullscreenKeyword,PopupOnFullscreenType
+
+" Focus wrapping
+syn keyword FocusWrappingKeyword force_focus_wrapping focus_wrapping contained
+syn keyword FocusWrappingType yes no contained
+syn match FocusWrapping /^\s*\(force_\)\?focus_wrapping\s\+\(yes\|no\)\s\?$/ contains=FocusWrappingType,FocusWrappingKeyword
+
+" Forcing Xinerama
+syn keyword ForceXineramaKeyword force_xinerama contained
+syn match ForceXinerama /^\s*force_xinerama\s\+\(yes\|no\)\s\?$/ contains=FocusWrappingType,ForceXineramaKeyword
+
+" Automatic back-and-forth when switching to the current workspace
+syn keyword AutomaticSwitchKeyword workspace_auto_back_and_forth contained
+syn match AutomaticSwitch /^\s*workspace_auto_back_and_forth\s\+\(yes\|no\)\s\?$/ contains=FocusWrappingType,AutomaticSwitchKeyword
+
+" Delay urgency hint
+syn keyword TimeUnit ms contained
+syn keyword DelayUrgencyKeyword force_display_urgency_hint contained
+syn match DelayUrgency /^\s*force_display_urgency_hint\s\+\d\+\s\+ms\s\?$/ contains=FocusWrappingType,DelayUrgencyKeyword,Number,TimeUnit
+
+" Focus on window activation
+syn keyword FocusOnActivationKeyword focus_on_window_activation contained
+syn keyword FocusOnActivationType smart urgent focus none contained
+syn match FocusOnActivation /^\s*focus_on_window_activation\s\+\(smart\|urgent\|focus\|none\)\s\?$/ contains=FocusOnActivationKeyword,FocusOnActivationType
+
+" Automatic back-and-forth when switching to the current workspace
+syn keyword DrawingMarksKeyword show_marks contained
+syn match DrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=FocusWrappingType,DrawingMarksKeyword
+
+" Group mode/bar
+syn keyword BlockKeyword 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_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
+syn region Block start=+.*s\?{$+ end=+^}$+ contains=BlockKeyword,String,Bind,Comment,Font,FocusWrappingType,Color,Variable transparent keepend extend
+
+" Line continuation
+syn region LineCont start=/^.*\\$/ end=/^.*$/ contains=BlockKeyword,String,Bind,Comment,Font,FocusWrappingType,Color,Variable transparent keepend extend
+
+" Define the highlighting.
+hi! def link Error Error
+hi! def link Todo Todo
+hi! def link Comment Comment
+hi! def link FontContent Type
+hi! def link FocusOnActivationType Type
+hi! def link PopupOnFullscreenType Type
+hi! def link OrientationKeyword Type
+hi! def link MouseWarpingType Type
+hi! def link FocusFollowsMouseType Type
+hi! def link GapStyleKeyword Type
+hi! def link LayoutKeyword Type
+hi! def link BorderStyleKeyword Type
+hi! def link EdgeKeyword Type
+hi! def link Action Type
+hi! def link Command Type
+hi! def link Output Type
+hi! def link WindowCommandSpecial Type
+hi! def link FocusWrappingType Type
+hi! def link FontSize Constant
+hi! def link Color Constant
+hi! def link Number Constant
+hi! def link VariableAndModifier Constant
+hi! def link TimeUnit Constant
+hi! def link Modifier Constant
+hi! def link String Constant
+hi! def link NegativeSize Constant
+hi! def link FontSeparator Special
+hi! def link VariableModifier Special
+hi! def link SizeSpecial Special
+hi! def link WindowSpecial Special
+hi! def link AssignSpecial Special
+hi! def link FontNamespace PreProc
+hi! def link BindArgument PreProc
+hi! def link NoStartupId PreProc
+hi! def link FontKeyword Identifier
+hi! def link BindKeyword Identifier
+hi! def link Orientation Identifier
+hi! def link GapStyle Identifier
+hi! def link Layout Identifier
+hi! def link BorderStyle Identifier
+hi! def link Edge Identifier
+hi! def link Floating Identifier
+hi! def link CommandKeyword Identifier
+hi! def link NoFocusKeyword Identifier
+hi! def link InitializeKeyword Identifier
+hi! def link AssignKeyword Identifier
+hi! def link ResourceKeyword Identifier
+hi! def link ExecKeyword Identifier
+hi! def link WorkspaceKeyword Identifier
+hi! def link ClientColorKeyword Identifier
+hi! def link InterprocessKeyword Identifier
+hi! def link MouseWarpingKeyword Identifier
+hi! def link FocusFollowsMouseKeyword Identifier
+hi! def link PopupOnFullscreenKeyword Identifier
+hi! def link FocusWrappingKeyword Identifier
+hi! def link ForceXineramaKeyword Identifier
+hi! def link AutomaticSwitchKeyword Identifier
+hi! def link DelayUrgencyKeyword Identifier
+hi! def link FocusOnActivationKeyword Identifier
+hi! def link DrawingMarksKeyword Identifier
+hi! def link BlockKeyword Identifier
+hi! def link Variable Statement
+hi! def link ArbitraryCommand Ignore
+
+let b:current_syntax = "i3config"
+
+endif