Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | " Language: XF86Config (XFree86 configuration file) |
Jan-Arvid Harrach | 8ab1819 | 2025-01-08 20:02:04 +0100 | [diff] [blame] | 3 | " Maintainer: This runtime file is looking for a new maintainer. |
| 4 | " Last Change: 2025 Jan 06 by Jan-Arvid Harrach (#16397) |
Bram Moolenaar | 166af9b | 2010-11-16 20:34:40 +0100 | [diff] [blame] | 5 | " Former Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz> |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 6 | " Last Change By David: 2010 Nov 01 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 7 | " |
| 8 | " Options: let xf86conf_xfree86_version = 3 or 4 |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 9 | " to force XFree86 3.x or 4.x XF86Config syntax |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 10 | |
| 11 | " Setup |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 12 | " quit when a syntax file was already loaded |
| 13 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 14 | finish |
| 15 | endif |
| 16 | |
| 17 | if !exists("b:xf86conf_xfree86_version") |
| 18 | if exists("xf86conf_xfree86_version") |
| 19 | let b:xf86conf_xfree86_version = xf86conf_xfree86_version |
| 20 | else |
| 21 | let b:xf86conf_xfree86_version = 4 |
| 22 | endif |
| 23 | endif |
| 24 | |
| 25 | syn case ignore |
| 26 | |
| 27 | " Comments |
| 28 | syn match xf86confComment "#.*$" contains=xf86confTodo |
| 29 | syn case match |
| 30 | syn keyword xf86confTodo FIXME TODO XXX NOT contained |
| 31 | syn case ignore |
| 32 | syn match xf86confTodo "???" contained |
| 33 | |
| 34 | " Sectioning errors |
| 35 | syn keyword xf86confSectionError Section contained |
| 36 | syn keyword xf86confSectionError EndSection |
| 37 | syn keyword xf86confSubSectionError SubSection |
| 38 | syn keyword xf86confSubSectionError EndSubSection |
| 39 | syn keyword xf86confModeSubSectionError Mode |
| 40 | syn keyword xf86confModeSubSectionError EndMode |
| 41 | syn cluster xf86confSectionErrors contains=xf86confSectionError,xf86confSubSectionError,xf86confModeSubSectionError |
| 42 | |
| 43 | " Values |
| 44 | if b:xf86conf_xfree86_version >= 4 |
| 45 | syn region xf86confString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=xf86confSpecialChar,xf86confConstant,xf86confOptionName oneline keepend nextgroup=xf86confValue skipwhite |
| 46 | else |
| 47 | syn region xf86confString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=xf86confSpecialChar,xf86confOptionName oneline keepend |
| 48 | endif |
| 49 | syn match xf86confSpecialChar "\\\d\d\d\|\\." contained |
| 50 | syn match xf86confDecimalNumber "\(\s\|-\)\zs\d*\.\=\d\+\>" |
| 51 | syn match xf86confFrequency "\(\s\|-\)\zs\d\+\.\=\d*\(Hz\|k\|kHz\|M\|MHz\)" |
| 52 | syn match xf86confOctalNumber "\<0\o\+\>" |
| 53 | syn match xf86confOctalNumberError "\<0\o\+[89]\d*\>" |
| 54 | syn match xf86confHexadecimalNumber "\<0x\x\+\>" |
| 55 | syn match xf86confValue "\s\+.*$" contained contains=xf86confComment,xf86confString,xf86confFrequency,xf86conf\w\+Number,xf86confConstant |
| 56 | syn keyword xf86confOption Option nextgroup=xf86confString skipwhite |
| 57 | syn match xf86confModeLineValue "\"[^\"]\+\"\(\_s\+[0-9.]\+\)\{9}" nextgroup=xf86confSync skipwhite skipnl |
| 58 | |
| 59 | " Sections and subsections |
| 60 | if b:xf86conf_xfree86_version >= 4 |
Jan-Arvid Harrach | 8ab1819 | 2025-01-08 20:02:04 +0100 | [diff] [blame] | 61 | syn region xf86confSection matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Input[_ ]*Device\|Device\|Video[_ ]*Adaptor\|Server[_ ]*Layout\|DRI\|Extensions\|Vendor\|Keyboard\|Pointer\|InputClass\|OutputClass\)\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOption,xf86confKeyword,xf86confSectionError |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 62 | syn region xf86confSectionModule matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Module\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionAny,xf86confComment,xf86confOption,xf86confKeyword |
| 63 | syn region xf86confSectionMonitor matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Monitor\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionMode,xf86confModeLine,xf86confComment,xf86confOption,xf86confKeyword |
| 64 | syn region xf86confSectionModes matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Modes\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionMode,xf86confModeLine,xf86confComment |
| 65 | syn region xf86confSectionScreen matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Screen\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionDisplay,xf86confComment,xf86confOption,xf86confKeyword |
| 66 | syn region xf86confSubSectionAny matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"[^\"]\+\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOption,xf86confKeyword,@xf86confSectionErrors |
| 67 | syn region xf86confSubSectionMode matchgroup=xf86confSectionDelim start="^\s*Mode\s\+\"[^\"]\+\"" end="^\s*EndMode\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confKeyword,@xf86confSectionErrors |
| 68 | syn region xf86confSubSectionDisplay matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"Display\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOption,xf86confKeyword,@xf86confSectionErrors |
| 69 | else |
| 70 | syn region xf86confSection matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Device\|Keyboard\|Pointer\)\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword |
| 71 | syn region xf86confSectionMX matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"\(Module\|Xinput\)\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionAny,xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword |
| 72 | syn region xf86confSectionMonitor matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Monitor\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionMode,xf86confModeLine,xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword |
| 73 | syn region xf86confSectionScreen matchgroup=xf86confSectionDelim start="^\s*Section\s\+\"Screen\"" end="^\s*EndSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confSubsectionDisplay,xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword |
| 74 | syn region xf86confSubSectionAny matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"[^\"]\+\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword,@xf86confSectionErrors |
| 75 | syn region xf86confSubSectionMode matchgroup=xf86confSectionDelim start="^\s*Mode\s\+\"[^\"]\+\"" end="^\s*EndMode\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword,@xf86confSectionErrors |
| 76 | syn region xf86confSubSectionDisplay matchgroup=xf86confSectionDelim start="^\s*SubSection\s\+\"Display\"" end="^\s*EndSubSection\>" skip="#.*$\|\"[^\"]*\"" contains=xf86confComment,xf86confOptionName,xf86confOption,xf86confKeyword,@xf86confSectionErrors |
| 77 | endif |
| 78 | |
| 79 | " Options |
| 80 | if b:xf86conf_xfree86_version >= 4 |
| 81 | command -nargs=+ Xf86confdeclopt syn keyword xf86confOptionName <args> contained |
| 82 | else |
| 83 | command -nargs=+ Xf86confdeclopt syn keyword xf86confOptionName <args> contained nextgroup=xf86confValue,xf86confComment skipwhite |
| 84 | endif |
| 85 | |
| 86 | Xf86confdeclopt 18bitBus AGPFastWrite AGPMode Accel AllowClosedownGrabs AllowDeactivateGrabs |
| 87 | Xf86confdeclopt AllowMouseOpenFail AllowNonLocalModInDev AllowNonLocalXvidtune AlwaysCore |
| 88 | Xf86confdeclopt AngleOffset AutoRepeat BaudRate BeamTimeout Beep BlankTime BlockWrite BottomX |
| 89 | Xf86confdeclopt BottomY ButtonNumber ButtonThreshold Buttons ByteSwap CacheLines ChordMiddle |
| 90 | Xf86confdeclopt ClearDTR ClearDTS ClickMode CloneDisplay CloneHSync CloneMode CloneVRefresh |
| 91 | Xf86confdeclopt ColorKey Composite CompositeSync CoreKeyboard CorePointer Crt2Memory CrtScreen |
| 92 | Xf86confdeclopt CrtcNumber CyberShadow CyberStretch DDC DDCMode DMAForXv DPMS Dac6Bit DacSpeed |
| 93 | Xf86confdeclopt DataBits Debug DebugLevel DefaultServerLayout DeltaX DeltaY Device DeviceName |
| 94 | Xf86confdeclopt DisableModInDev DisableVidModeExtension Display Display1400 DontVTSwitch |
| 95 | Xf86confdeclopt DontZap DontZoom DoubleScan DozeMode DozeScan DozeTime DragLockButtons |
| 96 | Xf86confdeclopt DualCount DualRefresh EarlyRasPrecharge Emulate3Buttons Emulate3Timeout |
| 97 | Xf86confdeclopt EmulateWheel EmulateWheelButton EmulateWheelInertia EnablePageFlip EnterCount |
| 98 | Xf86confdeclopt EstimateSizesAggressively ExternDisp FPClock16 FPClock24 FPClock32 |
| 99 | Xf86confdeclopt FPClock8 FPDither FastDram FifoAggresive FifoConservative FifoModerate |
| 100 | Xf86confdeclopt FireGL3000 FixPanelSize FlatPanel FlipXY FlowControl ForceCRT1 ForceCRT2Type |
| 101 | Xf86confdeclopt ForceLegacyCRT ForcePCIMode FpmVRAM FrameBufferWC FullMMIO GammaBrightness |
| 102 | Xf86confdeclopt HWClocks HWCursor HandleSpecialKeys HistorySize Interlace Interlaced InternDisp |
| 103 | Xf86confdeclopt InvX InvY InvertX InvertY KeepShape LCDClock LateRasPrecharge LcdCenter |
| 104 | Xf86confdeclopt LeftAlt Linear MGASDRAM MMIO MMIOCache MTTR MaxX MaxY MaximumXPosition |
| 105 | Xf86confdeclopt MaximumYPosition MinX MinY MinimumXPosition MinimumYPosition NoAccel |
| 106 | Xf86confdeclopt NoAllowMouseOpenFail NoAllowNonLocalModInDev NoAllowNonLocalXvidtune |
| 107 | Xf86confdeclopt NoBlockWrite NoCompositeSync NoCompression NoCrtScreen NoCyberShadow NoDCC |
| 108 | Xf86confdeclopt NoDDC NoDac6Bit NoDebug NoDisableModInDev NoDisableVidModeExtension NoDontZap |
| 109 | Xf86confdeclopt NoDontZoom NoFireGL3000 NoFixPanelSize NoFpmVRAM NoFrameBufferWC NoHWClocks |
| 110 | Xf86confdeclopt NoHWCursor NoHal NoLcdCenter NoLinear NoMGASDRAM NoMMIO NoMMIOCache NoMTTR |
| 111 | Xf86confdeclopt NoOverClockMem NoOverlay NoPC98 NoPM NoPciBurst NoPciRetry NoProbeClock |
| 112 | Xf86confdeclopt NoSTN NoSWCursor NoShadowFb NoShowCache NoSlowEDODRAM NoStretch NoSuspendHack |
| 113 | Xf86confdeclopt NoTexturedVideo NoTrapSignals NoUseFBDev NoUseModeline NoUseVclk1 NoVTSysReq |
| 114 | Xf86confdeclopt NoXVideo NvAGP OSMImageBuffers OffTime Origin OverClockMem Overlay |
| 115 | Xf86confdeclopt PC98 PCIBurst PM PWMActive PWMSleep PanelDelayCompensation PanelHeight |
| 116 | Xf86confdeclopt PanelOff PanelWidth Parity PciBurst PciRetry Pixmap Port PressDur PressPitch |
| 117 | Xf86confdeclopt PressVol ProbeClocks ProgramFPRegs Protocol RGBBits ReleaseDur ReleasePitch |
| 118 | Xf86confdeclopt ReportingMode Resolution RightAlt RightCtl Rotate STN SWCursor SampleRate |
| 119 | Xf86confdeclopt ScreenNumber ScrollLock SendCoreEvents SendDragEvents Serial ServerNumLock |
| 120 | Xf86confdeclopt SetLcdClk SetMClk SetRefClk ShadowFb ShadowStatus ShowCache SleepMode |
| 121 | Xf86confdeclopt SleepScan SleepTime SlowDram SlowEDODRAM StandbyTime StopBits Stretch |
| 122 | Xf86confdeclopt SuspendHack SuspendTime SwapXY SyncOnGreen TV TVOutput TVOverscan TVStandard |
| 123 | Xf86confdeclopt TVXPosOffset TVYPosOffset TexturedVideo Threshold Tilt TopX TopY TouchTime |
| 124 | Xf86confdeclopt TrapSignals Type USB UseBIOS UseFB UseFBDev UseFlatPanel UseModeline |
| 125 | Xf86confdeclopt UseROMData UseVclk1 VTInit VTSysReq VTime VideoKey Vmin XAxisMapping |
| 126 | Xf86confdeclopt XLeds XVideo XaaNoCPUToScreenColorExpandFill XaaNoColor8x8PatternFillRect |
| 127 | Xf86confdeclopt XaaNoColor8x8PatternFillTrap XaaNoDashedBresenhamLine XaaNoDashedTwoPointLine |
| 128 | Xf86confdeclopt XaaNoImageWriteRect XaaNoMono8x8PatternFillRect XaaNoMono8x8PatternFillTrap |
| 129 | Xf86confdeclopt XaaNoOffscreenPixmaps XaaNoPixmapCache XaaNoScanlineCPUToScreenColorExpandFill |
| 130 | Xf86confdeclopt XaaNoScanlineImageWriteRect XaaNoScreenToScreenColorExpandFill |
| 131 | Xf86confdeclopt XaaNoScreenToScreenCopy XaaNoSolidBresenhamLine XaaNoSolidFillRect |
| 132 | Xf86confdeclopt XaaNoSolidFillTrap XaaNoSolidHorVertLine XaaNoSolidTwoPointLine Xinerama |
| 133 | Xf86confdeclopt XkbCompat XkbDisable XkbGeometry XkbKeycodes XkbKeymap XkbLayout XkbModel |
| 134 | Xf86confdeclopt XkbOptions XkbRules XkbSymbols XkbTypes XkbVariant XvBskew XvHsync XvOnCRT2 |
| 135 | Xf86confdeclopt XvRskew XvVsync YAxisMapping ZAxisMapping ZoomOnLCD |
| 136 | |
| 137 | delcommand Xf86confdeclopt |
| 138 | |
| 139 | " Keywords |
| 140 | syn keyword xf86confKeyword Device Driver FontPath Group Identifier Load ModelName ModulePath Monitor RGBPath VendorName VideoAdaptor Visual nextgroup=xf86confComment,xf86confString skipwhite |
| 141 | syn keyword xf86confKeyword BiosBase Black BoardName BusID ChipID ChipRev Chipset nextgroup=xf86confComment,xf86confValue |
| 142 | syn keyword xf86confKeyword ClockChip Clocks DacSpeed DefaultDepth DefaultFbBpp nextgroup=xf86confComment,xf86confValue |
| 143 | syn keyword xf86confKeyword DefaultColorDepth nextgroup=xf86confComment,xf86confValue |
| 144 | syn keyword xf86confKeyword Depth DisplaySize DotClock FbBpp Flags Gamma HorizSync nextgroup=xf86confComment,xf86confValue |
| 145 | syn keyword xf86confKeyword Hskew HTimings InputDevice IOBase MemBase Mode nextgroup=xf86confComment,xf86confValue |
| 146 | syn keyword xf86confKeyword Modes Ramdac Screen TextClockFreq UseModes VendorName nextgroup=xf86confComment,xf86confValue |
| 147 | syn keyword xf86confKeyword VertRefresh VideoRam ViewPort Virtual VScan VTimings nextgroup=xf86confComment,xf86confValue |
| 148 | syn keyword xf86confKeyword Weight White nextgroup=xf86confComment,xf86confValue |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 149 | syn keyword xf86confMatch MatchDevicePath MatchDriver MatchLayout MatchOS MatchPnPID MatchProduct MatchTag MatchUSBID MatchVendor nextgroup=xf86confComment,xf86confString skipwhite |
| 150 | syn keyword xf86confMatch MatchIsPointer MatchIsKeyboard MatchIsTouchpad MatchIsTouchscreen MatchIsJoystick nextgroup=xf86confComment,xf86confValue skipwhite |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 151 | syn keyword xf86confModeLine ModeLine nextgroup=xf86confComment,xf86confModeLineValue skipwhite skipnl |
| 152 | |
| 153 | " Constants |
| 154 | if b:xf86conf_xfree86_version >= 4 |
| 155 | syn keyword xf86confConstant true false on off yes no omit contained |
| 156 | else |
| 157 | syn keyword xf86confConstant Meta Compose Control |
| 158 | endif |
| 159 | syn keyword xf86confConstant StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor contained |
| 160 | syn keyword xf86confConstant Absolute RightOf LeftOf Above Below Relative StaticGray GrayScale StaticColor PseudoColor TrueColor DirectColor contained |
| 161 | syn match xf86confSync "\(\s\+[+-][CHV]_*Sync\)\+" contained |
| 162 | |
| 163 | " Synchronization |
| 164 | if b:xf86conf_xfree86_version >= 4 |
Jan-Arvid Harrach | 8ab1819 | 2025-01-08 20:02:04 +0100 | [diff] [blame] | 165 | syn sync match xf86confSyncSection grouphere xf86confSection "^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Input[_ ]*Device\|Device\|Video[_ ]*Adaptor\|Server[_ ]*Layout\|DRI\|Extensions\|Vendor\|Keyboard\|Pointer\|InputClass\|OutputClass\)\"" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 166 | syn sync match xf86confSyncSectionModule grouphere xf86confSectionModule "^\s*Section\s\+\"Module\"" |
| 167 | syn sync match xf86confSyncSectionModes groupthere xf86confSectionModes "^\s*Section\s\+\"Modes\"" |
| 168 | else |
| 169 | syn sync match xf86confSyncSection grouphere xf86confSection "^\s*Section\s\+\"\(Files\|Server[_ ]*Flags\|Device\|Keyboard\|Pointer\)\"" |
| 170 | syn sync match xf86confSyncSectionMX grouphere xf86confSectionMX "^\s*Section\s\+\"\(Module\|Xinput\)\"" |
| 171 | endif |
| 172 | syn sync match xf86confSyncSectionMonitor groupthere xf86confSectionMonitor "^\s*Section\s\+\"Monitor\"" |
| 173 | syn sync match xf86confSyncSectionScreen groupthere xf86confSectionScreen "^\s*Section\s\+\"Screen\"" |
| 174 | syn sync match xf86confSyncEndSection groupthere NONE "^\s*End_*Section\s*$" |
| 175 | |
| 176 | " Define the default highlighting |
| 177 | hi def link xf86confComment Comment |
| 178 | hi def link xf86confTodo Todo |
| 179 | hi def link xf86confSectionDelim Statement |
| 180 | hi def link xf86confOptionName Identifier |
| 181 | |
| 182 | hi def link xf86confSectionError xf86confError |
| 183 | hi def link xf86confSubSectionError xf86confError |
| 184 | hi def link xf86confModeSubSectionError xf86confError |
| 185 | hi def link xf86confOctalNumberError xf86confError |
| 186 | hi def link xf86confError Error |
| 187 | |
| 188 | hi def link xf86confOption xf86confKeyword |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 189 | hi def link xf86confMatch xf86confKeyword |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 190 | hi def link xf86confModeLine xf86confKeyword |
| 191 | hi def link xf86confKeyword Type |
| 192 | |
| 193 | hi def link xf86confDecimalNumber xf86confNumber |
| 194 | hi def link xf86confOctalNumber xf86confNumber |
| 195 | hi def link xf86confHexadecimalNumber xf86confNumber |
| 196 | hi def link xf86confFrequency xf86confNumber |
| 197 | hi def link xf86confModeLineValue Constant |
| 198 | hi def link xf86confNumber Constant |
| 199 | |
| 200 | hi def link xf86confSync xf86confConstant |
| 201 | hi def link xf86confConstant Special |
| 202 | hi def link xf86confSpecialChar Special |
| 203 | hi def link xf86confString String |
| 204 | |
| 205 | hi def link xf86confValue Constant |
| 206 | |
| 207 | let b:current_syntax = "xf86conf" |