3 " Maintaner: Radu Dineiu <radu.dineiu@gmail.com>
4 " URL: http://ld.yi.org/vim/fstab.vim
5 " Last Change: 2007 Apr 24
9 " David Necas (Yeti) <yeti@physics.muni.cz>
10 " Stefano Zacchiroli <zack@debian.org>
11 " Georgi Georgiev <chutz@gg3.net>
14 " let fstab_unknown_fs_errors = 1
15 " highlight unknown filesystems as errors
19 elseif exists("b:current_syntax")
24 syn cluster fsGeneralCluster contains=fsComment
25 syn match fsComment /\s*#.*/
26 syn match fsOperator /[,=:]/
29 syn cluster fsDeviceCluster contains=fsOperator,fsDeviceKeyword,fsDeviceError
30 syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained
31 syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts sysfs usbfs
32 syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel
33 syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID
34 syn match fsDeviceKeyword contained /^[a-zA-Z0-9.\-]\+\ze:/
35 syn match fsDeviceLabel contained /=[^ \t]\+/hs=s+1 contains=fsOperator
36 syn match fsDeviceUUID contained /=[^ \t]\+/hs=s+1 contains=fsOperator
39 syn cluster fsMountPointCluster contains=fsMountPointKeyword,fsMountPointError
40 syn match fsMountPointError /\%([^ \ta-zA-Z0-9_\/#@\.-]\|\s\+\zs\w\{-}\ze\s\)/ contained
41 syn keyword fsMountPointKeyword contained none swap
44 syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown
45 syn match fsTypeUnknown /\s\+\zs\w\+/ contained
46 syn keyword fsTypeKeyword contained adfs ados affs atfs audiofs auto autofs befs bfs cd9660 cfs cifs coda cramfs devfs devpts e2compr efs ext2 ext2fs ext3 fdesc ffs filecore hfs hpfs iso9660 jffs jffs2 jfs kernfs lfs linprocfs mfs minix msdos ncpfs nfs none ntfs null nwfs overlay ovlfs portal proc procfs ptyfs qnx4 reiserfs romfs shm smbfs std subfs swap sysfs sysv tcfs tmpfs udf ufs umap umsdos union usbfs userfs vfat vs3fs vxfs wrapfs wvfs xfs zisofs
51 syn cluster fsOptionsCluster contains=fsOperator,fsOptionsGeneral,fsOptionsKeywords,fsTypeUnknown
52 syn match fsOptionsNumber /\d\+/
53 syn match fsOptionsNumberOctal /[0-8]\+/
54 syn match fsOptionsString /[a-zA-Z0-9_-]\+/
55 syn keyword fsOptionsYesNo yes no
56 syn cluster fsOptionsCheckCluster contains=fsOptionsExt2Check,fsOptionsFatCheck
57 syn keyword fsOptionsSize 512 1024 2048
58 syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand nosuid nosymfollow nouser owner rbind rdonly remount ro rq rw suid suiddir supermount sw sync union update user users xx
59 syn match fsOptionsGeneral /_netdev/
62 syn match fsOptionsKeywords contained /\<\%([ug]id\|o\%(wn\|th\)mask\)=/ nextgroup=fsOptionsNumber
65 syn match fsOptionsKeywords contained /\<\%(set[ug]id\|mode\|reserved\)=/ nextgroup=fsOptionsNumber
66 syn match fsOptionsKeywords contained /\<\%(prefix\|volume\|root\)=/ nextgroup=fsOptionsString
67 syn match fsOptionsKeywords contained /\<bs=/ nextgroup=fsOptionsSize
68 syn keyword fsOptionsKeywords contained protect usemp verbose
71 syn keyword fsOptionsKeywords contained extatt gens norrip nostrictjoilet
74 " -- everything already defined
77 syn match fsOptionsKeywords contained /\<check=*/ nextgroup=@fsOptionsCheckCluster
78 syn match fsOptionsKeywords contained /\<errors=/ nextgroup=fsOptionsExt2Errors
79 syn match fsOptionsKeywords contained /\<\%(res[gu]id\|sb\)=/ nextgroup=fsOptionsNumber
80 syn keyword fsOptionsExt2Check contained none normal strict
81 syn keyword fsOptionsExt2Errors contained continue panic
82 syn match fsOptionsExt2Errors contained /\<remount-ro\>/
83 syn keyword fsOptionsKeywords contained acl bsddf minixdf debug grpid bsdgroups minixdf noacl nocheck nogrpid oldalloc orlov sysvgroups nouid32 nobh user_xattr nouser_xattr
86 syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt3Journal
87 syn match fsOptionsKeywords contained /\<data=/ nextgroup=fsOptionsExt3Data
88 syn match fsOptionsKeywords contained /\<commit=/ nextgroup=fsOptionsNumber
89 syn keyword fsOptionsExt3Journal contained update inum
90 syn keyword fsOptionsExt3Data contained journal ordered writeback
91 syn keyword fsOptionsKeywords contained noload
94 syn match fsOptionsKeywords contained /\<blocksize=/ nextgroup=fsOptionsSize
95 syn match fsOptionsKeywords contained /\<\%([dfu]mask\|codepage\)=/ nextgroup=fsOptionsNumberOctal
96 syn match fsOptionsKeywords contained /\%(cvf_\%(format\|option\)\|iocharset\)=/ nextgroup=fsOptionsString
97 syn match fsOptionsKeywords contained /\<check=/ nextgroup=@fsOptionsCheckCluster
98 syn match fsOptionsKeywords contained /\<conv=*/ nextgroup=fsOptionsConv
99 syn match fsOptionsKeywords contained /\<fat=/ nextgroup=fsOptionsFatType
100 syn match fsOptionsKeywords contained /\<dotsOK=/ nextgroup=fsOptionsYesNo
101 syn keyword fsOptionsFatCheck contained r n s relaxed normal strict
102 syn keyword fsOptionsConv contained b t a binary text auto
103 syn keyword fsOptionsFatType contained 12 16 32
104 syn keyword fsOptionsKeywords contained quiet sys_immutable showexec dots nodots
107 syn match fsOptionsKeywords contained /\<\%(creator|type\)=/ nextgroup=fsOptionsString
108 syn match fsOptionsKeywords contained /\<\%(dir\|file\|\)_umask=/ nextgroup=fsOptionsNumberOctal
109 syn match fsOptionsKeywords contained /\<\%(session\|part\)=/ nextgroup=fsOptionsNumber
112 syn keyword fsOptionsKeyWords contained softdep
115 syn match fsOptionsKeywords contained /\<case=/ nextgroup=fsOptionsHpfsCase
116 syn keyword fsOptionsHpfsCase contained lower asis
119 syn match fsOptionsKeywords contained /\<map=/ nextgroup=fsOptionsIsoMap
120 syn match fsOptionsKeywords contained /\<block=/ nextgroup=fsOptionsSize
121 syn match fsOptionsKeywords contained /\<\%(session\|sbsector\)=/ nextgroup=fsOptionsNumber
122 syn keyword fsOptionsIsoMap contained n o a normal off acorn
123 syn keyword fsOptionsKeywords contained norock nojoilet unhide cruft
124 syn keyword fsOptionsConv contained m mtext
127 syn keyword fsOptionsKeywords nointegrity integrity
130 syn match fsOptionsKeywords contained /\<\%(rsize\|wsize\|timeo\|retrans\|acregmin\|acregmax\|acdirmin\|acdirmax\|actimeo\|retry\|port\|mountport\|mounthost\|mountprog\|mountvers\|nfsprog\|nfsvers\|namelen\)=/ nextgroup=fsOptionsString
131 syn keyword fsOptionsKeywords contained bg fg soft hard intr cto ac tcp udp lock nobg nofg nosoft nohard nointr noposix nocto noac notcp noudp nolock
134 syn match fsOptionsKeywords contained /\<\%(posix=*\|uni_xlate=\)/ nextgroup=fsOptionsNumber
135 syn keyword fsOptionsKeywords contained utf8
138 " -- everything already defined
141 syn match fsOptionsKeywords contained /\<hash=/ nextgroup=fsOptionsReiserHash
142 syn match fsOptionsKeywords contained /\<resize=/ nextgroup=fsOptionsNumber
143 syn keyword fsOptionsReiserHash contained rupasov tea r5 detect
144 syn keyword fsOptionsKeywords contained hashed_relocation noborder nolog notail no_unhashed_relocation replayonly
147 syn match fsOptionsKeywords contained /\<fs=/ nextgroup=fsOptionsString
148 syn keyword fsOptionsKeywords contained procuid
151 syn match fsOptionsKeywords contained /\<pri=/ nextgroup=fsOptionsNumber
154 syn match fsOptionsKeywords contained /\<nr_\%(blocks\|inodes\)=/ nextgroup=fsOptionsNumber
157 syn match fsOptionsKeywords contained /\<\%(anchor\|partition\|lastblock\|fileset\|rootdir\)=/ nextgroup=fsOptionsString
158 syn keyword fsOptionsKeywords contained unhide undelete strict novrs
161 syn match fsOptionsKeywords contained /\<ufstype=/ nextgroup=fsOptionsUfsType
162 syn match fsOptionsKeywords contained /\<onerror=/ nextgroup=fsOptionsUfsError
163 syn keyword fsOptionsUfsType contained old hp 44bsd sun sunx86 nextstep openstep
164 syn match fsOptionsUfsType contained /\<nextstep-cd\>/
165 syn keyword fsOptionsUfsError contained panic lock umount repair
168 syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)\%(id\|gid\)=/ nextgroup=fsOptionsNumber
169 syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)mode=/ nextgroup=fsOptionsNumberOctal
172 syn keyword fsOptionsKeywords contained nonumtail posix utf8
173 syn match fsOptionsKeywords contained /shortname=/ nextgroup=fsOptionsVfatShortname
174 syn keyword fsOptionsVfatShortname contained lower win95 winnt mixed
177 syn match fsOptionsKeywords contained /\%(biosize\|logbufs\|logbsize\|logdev\|rtdev\|sunit\|swidth\)=/ nextgroup=fsOptionsString
178 syn keyword fsOptionsKeywords contained dmapi xdsm noalign noatime noquota norecovery osyncisdsync quota usrquota uqnoenforce grpquota gqnoenforce
180 " Frequency / Pass No.
181 syn cluster fsFreqPassCluster contains=fsFreqPassNumber,fsFreqPassError
182 syn match fsFreqPassError /\s\+\zs\%(\D.*\|\S.*\|\d\+\s\+[^012]\)\ze/ contained
183 syn match fsFreqPassNumber /\d\+\s\+[012]\s*/ contained
186 syn match fsDevice /^\s*\zs.\{-1,}\s/me=e-1 nextgroup=fsMountPoint contains=@fsDeviceCluster,@fsGeneralCluster
187 syn match fsMountPoint /\s\+.\{-}\s/me=e-1 nextgroup=fsType contains=@fsMountPointCluster,@fsGeneralCluster contained
188 syn match fsType /\s\+.\{-}\s/me=e-1 nextgroup=fsOptions contains=@fsTypeCluster,@fsGeneralCluster contained
189 syn match fsOptions /\s\+.\{-}\s/me=e-1 nextgroup=fsFreqPass contains=@fsOptionsCluster,@fsGeneralCluster contained
190 syn match fsFreqPass /\s\+.\{-}$/ contains=@fsFreqPassCluster,@fsGeneralCluster contained
192 " Whole line comments
193 syn match fsCommentLine /^#.*$/
195 if version >= 508 || !exists("did_config_syntax_inits")
197 let did_config_syntax_inits = 1
198 command! -nargs=+ HiLink hi link <args>
200 command! -nargs=+ HiLink hi def link <args>
203 HiLink fsOperator Operator
204 HiLink fsComment Comment
205 HiLink fsCommentLine Comment
207 HiLink fsTypeKeyword Type
208 HiLink fsDeviceKeyword Identifier
209 HiLink fsDeviceLabel String
210 HiLink fsDeviceUUID String
211 HiLink fsFreqPassNumber Number
213 if exists('fstab_unknown_fs_errors') && fstab_unknown_fs_errors == 1
214 HiLink fsTypeUnknown Error
216 HiLink fsDeviceError Error
217 HiLink fsMountPointError Error
218 HiLink fsMountPointKeyword Keyword
219 HiLink fsFreqPassError Error
221 HiLink fsOptionsGeneral Type
222 HiLink fsOptionsKeywords Keyword
223 HiLink fsOptionsNumber Number
224 HiLink fsOptionsNumberOctal Number
225 HiLink fsOptionsString String
226 HiLink fsOptionsSize Number
227 HiLink fsOptionsExt2Check String
228 HiLink fsOptionsExt2Errors String
229 HiLink fsOptionsExt3Journal String
230 HiLink fsOptionsExt3Data String
231 HiLink fsOptionsFatCheck String
232 HiLink fsOptionsConv String
233 HiLink fsOptionsFatType Number
234 HiLink fsOptionsYesNo String
235 HiLink fsOptionsHpfsCase String
236 HiLink fsOptionsIsoMap String
237 HiLink fsOptionsReiserHash String
238 HiLink fsOptionsUfsType String
239 HiLink fsOptionsUfsError String
241 HiLink fsOptionsVfatShortname String
246 let b:current_syntax = "fstab"