vim-polyglot/syntax/i3config.vim

255 lines
15 KiB
VimL
Raw Normal View History

if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'i3') != -1
finish
endif
2018-12-26 05:19:25 -05:00
" Vim syntax file
" Language: i3 config file
" Maintainer: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
2019-03-29 15:30:36 -04:00
" Version: 0.4
" Last Change: 2019-03-23 21:54
2018-12-26 05:19:25 -05:00
" 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
2019-03-29 15:30:36 -04:00
syn match i3ConfigError /.*/
2018-12-26 05:19:25 -05:00
" Todo
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigTodo TODO FIXME XXX contained
2018-12-26 05:19:25 -05:00
" Comment
" Comments are started with a # and can only be used at the beginning of a line
2019-03-29 15:30:36 -04:00
syn match i3ConfigComment /^\s*#.*$/ contains=i3ConfigTodo
2018-12-26 05:19:25 -05:00
" Font
" A FreeType font description is composed by:
" a font family, a style, a weight, a variant, a stretch and a size.
2019-03-29 15:30:36 -04:00
syn match i3ConfigFontSeparator /,/ contained
syn match i3ConfigFontSeparator /:/ contained
syn keyword i3ConfigFontKeyword font contained
syn match i3ConfigFontNamespace /\w\+:/ contained contains=i3ConfigFontSeparator
syn match i3ConfigFontContent /-\?\w\+\(-\+\|\s\+\|,\)/ contained contains=i3ConfigFontNamespace,i3ConfigFontSeparator,i3ConfigFontKeyword
syn match i3ConfigFontSize /\s\=\d\+\(px\)\?\s\?$/ contained
syn match i3ConfigFont /^\s*font\s\+.*$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
"syn match i3ConfigFont /^\s*font\s\+.*\(\\\_.*\)\?$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
"syn match i3ConfigFont /^\s*font\s\+.*\(\\\_.*\)\?[^\\]\+$/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
"syn match i3ConfigFont /^\s*font\s\+\(\(.*\\\_.*\)\|\(.*[^\\]\+$\)\)/ contains=i3ConfigFontContent,i3ConfigFontSeparator,i3ConfigFontSize,i3ConfigFontNamespace
2018-12-26 05:19:25 -05:00
" variables
2019-03-29 15:30:36 -04:00
syn match i3ConfigString /\(['"]\)\(.\{-}\)\1/ contained
syn match i3ConfigColor /#\w\{6}/ contained
syn match i3ConfigVariableModifier /+/ contained
syn match i3ConfigVariableAndModifier /+\w\+/ contained contains=i3ConfigVariableModifier
syn match i3ConfigVariable /\$\w\+\(\(-\w\+\)\+\)\?\(\s\|+\)\?/ contains=i3ConfigVariableModifier,i3ConfigVariableAndModifier
syn keyword i3ConfigInitializeKeyword set contained
syn match i3ConfigInitialize /^\s*set\s\+.*$/ contains=i3ConfigVariable,i3ConfigInitializeKeyword,i3ConfigColor,i3ConfigString
2018-12-26 05:19:25 -05:00
" Gaps
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigGapStyleKeyword inner outer horizontal vertical top right bottom left current all set plus minus toggle contained
2019-04-23 05:32:40 -04:00
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,number,i3ConfigVariable
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigSmartGapKeyword on inverse_outer contained
syn match i3ConfigSmartGap /^\s*smart_gaps\s\+\(on\|inverse_outer\)\s\?$/ contains=i3ConfigSmartGapKeyword
syn keyword i3ConfigSmartBorderKeyword on no_gaps contained
syn match i3ConfigSmartBorder /^\s*smart_borders\s\+\(on\|no_gaps\)\s\?$/ contains=i3ConfigSmartBorderKeyword
2018-12-26 05:19:25 -05:00
" Keyboard bindings
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigAction toggle fullscreen restart key import kill shrink grow contained
syn keyword i3ConfigAction focus move split layout resize restore reload mute unmute exit contained
syn match i3ConfigModifier /\w\++\w\+\(\(+\w\+\)\+\)\?/ contained contains=i3ConfigVariableModifier
syn match i3ConfigNumber /\s\d\+/ contained
syn keyword i3ConfigBindKeyword bindsym bindcode exec gaps contained
syn match i3ConfigBindArgument /--\w\+\(\(-\w\+\)\+\)\?\s/ contained
syn match i3ConfigBind /^\s*\(bindsym\|bindcode\)\s\+.*$/ contains=i3ConfigVariable,i3ConfigBindKeyword,i3ConfigVariableAndModifier,i3ConfigBindArgument,i3ConfigNumber,i3ConfigModifier,i3ConfigAction,i3ConfigString,i3ConfigGapStyleKeyword
2018-12-26 05:19:25 -05:00
" Floating
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigSizeSpecial x contained
syn match i3ConfigNegativeSize /-/ contained
syn match i3ConfigSize /-\?\d\+\s\?x\s\?-\?\d\+/ contained contains=i3ConfigSizeSpecial,i3ConfigNumber,i3ConfigNegativeSize
syn match i3ConfigFloating /^\s*floating_modifier\s\+\$\w\+\d\?/ contains=i3ConfigVariable
syn match i3ConfigFloating /^\s*floating_\(maximum\|minimum\)_size\s\+-\?\d\+\s\?x\s\?-\?\d\+/ contains=Size
2018-12-26 05:19:25 -05:00
" Orientation
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigOrientationKeyword vertical horizontal auto contained
syn match i3ConfigOrientation /^\s*default_orientation\s\+\(vertical\|horizontal\|auto\)\s\?$/ contains=i3ConfigOrientationKeyword
2018-12-26 05:19:25 -05:00
" Layout
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigLayoutKeyword default stacking tabbed contained
syn match i3ConfigLayout /^\s*workspace_layout\s\+\(default\|stacking\|tabbed\)\s\?$/ contains=i3ConfigLayoutKeyword
2018-12-26 05:19:25 -05:00
" Border style
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigBorderStyleKeyword none normal pixel contained
syn match i3ConfigBorderStyle /^\s*\(new_window\|new_float\|default_border\|default_floating_border\)\s\+\(none\|\(normal\|pixel\)\(\s\+\d\+\)\?\)\s\?$/ contains=i3ConfigBorderStyleKeyword,number
2018-12-26 05:19:25 -05:00
" Hide borders and edges
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigEdgeKeyword none vertical horizontal both smart smart_no_gaps contained
syn match i3ConfigEdge /^\s*hide_edge_borders\s\+\(none\|vertical\|horizontal\|both\|smart\|smart_no_gaps\)\s\?$/ contains=i3ConfigEdgeKeyword
2018-12-26 05:19:25 -05:00
" Arbitrary commands for specific windows (for_window)
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigCommandKeyword for_window contained
syn region i3ConfigWindowStringSpecial start=+"+ skip=+\\"+ end=+"+ contained contains=i3ConfigString
syn region i3ConfigWindowCommandSpecial start="\[" end="\]" contained contains=WindowStringSpacial,i3ConfigString
syn match i3ConfigArbitraryCommand /^\s*for_window\s\+.*$/ contains=i3ConfigWindowCommandSpecial,i3ConfigCommandKeyword,i3ConfigBorderStyleKeyword,i3ConfigLayoutKeyword,i3ConfigOrientationKeyword,Size,i3ConfigNumber
2018-12-26 05:19:25 -05:00
" Disable focus open opening
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigNoFocusKeyword no_focus contained
syn match i3ConfigDisableFocus /^\s*no_focus\s\+.*$/ contains=i3ConfigWindowCommandSpecial,i3ConfigNoFocusKeyword
2018-12-26 05:19:25 -05:00
" Move client to specific workspace automatically
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigAssignKeyword assign contained
syn match i3ConfigAssignSpecial /→/ contained
syn match i3ConfigAssign /^\s*assign\s\+.*$/ contains=i3ConfigAssignKeyword,i3ConfigWindowCommandSpecial,i3ConfigAssignSpecial
2018-12-26 05:19:25 -05:00
" X resources
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigResourceKeyword set_from_resource contained
syn match i3ConfigResource /^\s*set_from_resource\s\+.*$/ contains=i3ConfigResourceKeyword,i3ConfigWindowCommandSpecial,i3ConfigColor,i3ConfigVariable
2018-12-26 05:19:25 -05:00
" Auto start applications
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigExecKeyword exec exec_always contained
syn match i3ConfigNoStartupId /--no-startup-id/ contained " We are not using i3ConfigBindArgument as only no-startup-id is supported here
syn match i3ConfigExec /^\s*exec\(_always\)\?\s\+.*$/ contains=i3ConfigExecKeyword,i3ConfigNoStartupId,i3ConfigString
2018-12-26 05:19:25 -05:00
" Automatically putting workspaces on specific screens
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigWorkspaceKeyword workspace contained
syn keyword i3ConfigOutput output contained
syn match i3ConfigWorkspace /^\s*workspace\s\+.*$/ contains=i3ConfigWorkspaceKeyword,i3ConfigNumber,i3ConfigString,i3ConfigOutput
2018-12-26 05:19:25 -05:00
" Changing colors
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigClientColorKeyword client focused focused_inactive unfocused urgent placeholder background contained
syn match i3ConfigClientColor /^\s*client.\w\+\s\+.*$/ contains=i3ConfigClientColorKeyword,i3ConfigColor,i3ConfigVariable
2018-12-26 05:19:25 -05:00
" Interprocess communication
2019-03-29 15:30:36 -04:00
syn match i3ConfigInterprocessKeyword /ipc-socket/ contained
syn match i3ConfigInterprocess /^\s*ipc-socket\s\+.*$/ contains=i3ConfigInterprocessKeyword
2018-12-26 05:19:25 -05:00
" Mouse warping
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigMouseWarpingKeyword mouse_warping contained
syn keyword i3ConfigMouseWarpingType output none contained
syn match i3ConfigMouseWarping /^\s*mouse_warping\s\+\(output\|none\)\s\?$/ contains=i3ConfigMouseWarpingKeyword,i3ConfigMouseWarpingType
2018-12-26 05:19:25 -05:00
" Focus follows mouse
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigFocusFollowsMouseKeyword focus_follows_mouse contained
syn keyword i3ConfigFocusFollowsMouseType yes no contained
syn match i3ConfigFocusFollowsMouse /^\s*focus_follows_mouse\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusFollowsMouseKeyword,i3ConfigFocusFollowsMouseType
2018-12-26 05:19:25 -05:00
" Popups during fullscreen mode
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigPopupOnFullscreenKeyword popup_during_fullscreen contained
syn keyword i3ConfigPopuponFullscreenType smart ignore leave_fullscreen contained
syn match i3ConfigPopupOnFullscreen /^\s*popup_during_fullscreen\s\+\w\+\s\?$/ contains=i3ConfigPopupOnFullscreenKeyword,i3ConfigPopupOnFullscreenType
2018-12-26 05:19:25 -05:00
" Focus wrapping
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigFocusWrappingKeyword force_focus_wrapping focus_wrapping contained
syn keyword i3ConfigFocusWrappingType yes no contained
syn match i3ConfigFocusWrapping /^\s*\(force_\)\?focus_wrapping\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigFocusWrappingKeyword
2018-12-26 05:19:25 -05:00
" Forcing Xinerama
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigForceXineramaKeyword force_xinerama contained
syn match i3ConfigForceXinerama /^\s*force_xinerama\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigForceXineramaKeyword
2018-12-26 05:19:25 -05:00
" Automatic back-and-forth when switching to the current workspace
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigAutomaticSwitchKeyword workspace_auto_back_and_forth contained
syn match i3ConfigAutomaticSwitch /^\s*workspace_auto_back_and_forth\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigAutomaticSwitchKeyword
2018-12-26 05:19:25 -05:00
" Delay urgency hint
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigTimeUnit ms contained
syn keyword i3ConfigDelayUrgencyKeyword force_display_urgency_hint contained
syn match i3ConfigDelayUrgency /^\s*force_display_urgency_hint\s\+\d\+\s\+ms\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigDelayUrgencyKeyword,i3ConfigNumber,i3ConfigTimeUnit
2018-12-26 05:19:25 -05:00
" Focus on window activation
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigFocusOnActivationKeyword focus_on_window_activation contained
syn keyword i3ConfigFocusOnActivationType smart urgent focus none contained
syn match i3ConfigFocusOnActivation /^\s*focus_on_window_activation\s\+\(smart\|urgent\|focus\|none\)\s\?$/ contains=i3ConfigFocusOnActivationKeyword,i3ConfigFocusOnActivationType
2018-12-26 05:19:25 -05:00
" Automatic back-and-forth when switching to the current workspace
2019-03-29 15:30:36 -04:00
syn keyword i3ConfigDrawingMarksKeyword show_marks contained
syn match i3ConfigDrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=i3ConfigFocusWrappingType,i3ConfigDrawingMarksKeyword
2018-12-26 05:19:25 -05:00
" Group mode/bar
2019-03-29 15:30:36 -04:00
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_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
syn region i3ConfigBlock start=+.*s\?{$+ end=+^}$+ contains=i3ConfigBlockKeyword,i3ConfigString,Bind,i3ConfigComment,Font,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
2018-12-26 05:19:25 -05:00
" Line continuation
2019-03-29 15:30:36 -04:00
syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=i3ConfigBlockKeyword,i3ConfigString,Bind,i3ConfigComment,Font,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
2018-12-26 05:19:25 -05:00
" Define the highlighting.
2019-03-29 15:30:36 -04:00
hi! def link i3ConfigError Error
hi! def link i3ConfigTodo Todo
hi! def link i3ConfigComment Comment
hi! def link i3ConfigFontContent Type
hi! def link i3ConfigFocusOnActivationType Type
hi! def link i3ConfigPopupOnFullscreenType Type
hi! def link i3ConfigOrientationKeyword Type
hi! def link i3ConfigMouseWarpingType Type
hi! def link i3ConfigFocusFollowsMouseType Type
hi! def link i3ConfigGapStyleKeyword Type
hi! def link i3ConfigSmartGapKeyword Type
hi! def link i3ConfigSmartBorderKeyword Type
hi! def link i3ConfigLayoutKeyword Type
hi! def link i3ConfigBorderStyleKeyword Type
hi! def link i3ConfigEdgeKeyword Type
hi! def link i3ConfigAction Type
hi! def link i3ConfigCommand Type
hi! def link i3ConfigOutput Type
hi! def link i3ConfigWindowCommandSpecial Type
hi! def link i3ConfigFocusWrappingType Type
hi! def link i3ConfigFontSize Constant
hi! def link i3ConfigColor Constant
hi! def link i3ConfigNumber Constant
hi! def link i3ConfigVariableAndModifier Constant
hi! def link i3ConfigTimeUnit Constant
hi! def link i3ConfigModifier Constant
hi! def link i3ConfigString Constant
hi! def link i3ConfigNegativeSize Constant
hi! def link i3ConfigFontSeparator Special
hi! def link i3ConfigVariableModifier Special
hi! def link i3ConfigSizeSpecial Special
hi! def link i3ConfigWindowSpecial Special
hi! def link i3ConfigAssignSpecial Special
hi! def link i3ConfigFontNamespace PreProc
hi! def link i3ConfigBindArgument PreProc
hi! def link i3ConfigNoStartupId PreProc
hi! def link i3ConfigFontKeyword Identifier
hi! def link i3ConfigBindKeyword Identifier
hi! def link i3ConfigOrientation Identifier
hi! def link i3ConfigGapStyle Identifier
hi! def link i3ConfigSmartGap Identifier
hi! def link i3ConfigSmartBorder Identifier
hi! def link i3ConfigLayout Identifier
hi! def link i3ConfigBorderStyle Identifier
hi! def link i3ConfigEdge Identifier
hi! def link i3ConfigFloating Identifier
hi! def link i3ConfigCommandKeyword Identifier
hi! def link i3ConfigNoFocusKeyword Identifier
hi! def link i3ConfigInitializeKeyword Identifier
hi! def link i3ConfigAssignKeyword Identifier
hi! def link i3ConfigResourceKeyword Identifier
hi! def link i3ConfigExecKeyword Identifier
hi! def link i3ConfigWorkspaceKeyword Identifier
hi! def link i3ConfigClientColorKeyword Identifier
hi! def link i3ConfigInterprocessKeyword Identifier
hi! def link i3ConfigMouseWarpingKeyword Identifier
hi! def link i3ConfigFocusFollowsMouseKeyword Identifier
hi! def link i3ConfigPopupOnFullscreenKeyword Identifier
hi! def link i3ConfigFocusWrappingKeyword Identifier
hi! def link i3ConfigForceXineramaKeyword Identifier
hi! def link i3ConfigAutomaticSwitchKeyword Identifier
hi! def link i3ConfigDelayUrgencyKeyword Identifier
hi! def link i3ConfigFocusOnActivationKeyword Identifier
hi! def link i3ConfigDrawingMarksKeyword Identifier
hi! def link i3ConfigBlockKeyword Identifier
hi! def link i3ConfigVariable Statement
hi! def link i3ConfigArbitraryCommand Type
2018-12-26 05:19:25 -05:00
let b:current_syntax = "i3config"