1" Vim syntax file
2" Language: fstab file
3" Maintaner: Radu Dineiu <radu.dineiu@gmail.com>
4" URL: http://ld.yi.org/vim/fstab.vim
5" Last Change: 2009 Feb 04
6" Version: 0.93
7"
8" Credits:
9"   David Necas (Yeti) <yeti@physics.muni.cz>
10"   Stefano Zacchiroli <zack@debian.org>
11"   Georgi Georgiev <chutz@gg3.net>
12"   James Vega <jamessan@debian.org>
13"   Elias Probst <mail@eliasprobst.eu>
14"
15" Options:
16"   let fstab_unknown_fs_errors = 1
17"     highlight unknown filesystems as errors
18
19if version < 600
20	syntax clear
21elseif exists("b:current_syntax")
22	finish
23endif
24
25" General
26syn cluster fsGeneralCluster contains=fsComment
27syn match fsComment /\s*#.*/
28syn match fsOperator /[,=:#]/
29
30" Device
31syn cluster fsDeviceCluster contains=fsOperator,fsDeviceKeyword,fsDeviceError
32syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained
33syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts sysfs usbfs
34syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel
35syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID
36syn keyword fsDeviceKeyword contained sshfs nextgroup=fsDeviceSshfs
37syn match fsDeviceKeyword contained /^[a-zA-Z0-9.\-]\+\ze:/
38syn match fsDeviceLabel contained /=[^ \t]\+/hs=s+1 contains=fsOperator
39syn match fsDeviceUUID contained /=[^ \t]\+/hs=s+1 contains=fsOperator
40syn match fsDeviceSshfs contained /#[_=[:alnum:]\.\/+-]\+@[a-z0-9._-]\+\a\{2}:[^ \t]\+/hs=s+1 contains=fsOperator
41
42" Mount Point
43syn cluster fsMountPointCluster contains=fsMountPointKeyword,fsMountPointError
44syn match fsMountPointError /\%([^ \ta-zA-Z0-9_\/#@\.-]\|\s\+\zs\w\{-}\ze\s\)/ contained
45syn keyword fsMountPointKeyword contained none swap
46
47" Type
48syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown
49syn match fsTypeUnknown /\s\+\zs\w\+/ contained
50syn keyword fsTypeKeyword contained adfs ados affs atfs audiofs auto autofs befs bfs cd9660 cfs cifs coda cramfs devfs devpts e2compr efs ext2 ext2fs ext3 ext4 fdesc ffs filecore fuse 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 sshfs std subfs swap sysfs sysv tcfs tmpfs udf ufs umap umsdos union usbfs userfs vfat vs3fs vxfs wrapfs wvfs xfs zisofs
51
52" Options
53" -------
54" Options: General
55syn cluster fsOptionsCluster contains=fsOperator,fsOptionsGeneral,fsOptionsKeywords,fsTypeUnknown
56syn match fsOptionsNumber /\d\+/
57syn match fsOptionsNumberOctal /[0-8]\+/
58syn match fsOptionsString /[a-zA-Z0-9_-]\+/
59syn keyword fsOptionsYesNo yes no
60syn cluster fsOptionsCheckCluster contains=fsOptionsExt2Check,fsOptionsFatCheck
61syn keyword fsOptionsSize 512 1024 2048
62syn 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
63syn match fsOptionsGeneral /_netdev/
64
65" Options: adfs
66syn match fsOptionsKeywords contained /\<\%([ug]id\|o\%(wn\|th\)mask\)=/ nextgroup=fsOptionsNumber
67
68" Options: affs
69syn match fsOptionsKeywords contained /\<\%(set[ug]id\|mode\|reserved\)=/ nextgroup=fsOptionsNumber
70syn match fsOptionsKeywords contained /\<\%(prefix\|volume\|root\)=/ nextgroup=fsOptionsString
71syn match fsOptionsKeywords contained /\<bs=/ nextgroup=fsOptionsSize
72syn keyword fsOptionsKeywords contained protect usemp verbose
73
74" Options: cd9660
75syn keyword fsOptionsKeywords contained extatt gens norrip nostrictjoilet
76
77" Options: devpts
78" -- everything already defined
79
80" Options: ext2
81syn match fsOptionsKeywords contained /\<check=*/ nextgroup=@fsOptionsCheckCluster
82syn match fsOptionsKeywords contained /\<errors=/ nextgroup=fsOptionsExt2Errors
83syn match fsOptionsKeywords contained /\<\%(res[gu]id\|sb\)=/ nextgroup=fsOptionsNumber
84syn keyword fsOptionsExt2Check contained none normal strict
85syn keyword fsOptionsExt2Errors contained continue panic
86syn match fsOptionsExt2Errors contained /\<remount-ro\>/
87syn keyword fsOptionsKeywords contained acl bsddf minixdf debug grpid bsdgroups minixdf noacl nocheck nogrpid oldalloc orlov sysvgroups nouid32 nobh user_xattr nouser_xattr
88
89" Options: ext3
90syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt3Journal
91syn match fsOptionsKeywords contained /\<data=/ nextgroup=fsOptionsExt3Data
92syn match fsOptionsKeywords contained /\<commit=/ nextgroup=fsOptionsNumber
93syn keyword fsOptionsExt3Journal contained update inum
94syn keyword fsOptionsExt3Data contained journal ordered writeback
95syn keyword fsOptionsKeywords contained noload user_xattr nouser_xattr acl noacl
96
97" Options: ext4
98syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt4Journal
99syn match fsOptionsKeywords contained /\<data=/ nextgroup=fsOptionsExt4Data
100syn match fsOptionsKeywords contained /\<barrier=/ nextgroup=fsOptionsExt4Barrier
101syn match fsOptionsKeywords contained /\<journal_dev=/ nextgroup=fsOptionsNumber
102syn match fsOptionsKeywords contained /\<resuid=/ nextgroup=fsOptionsNumber
103syn match fsOptionsKeywords contained /\<resgid=/ nextgroup=fsOptionsNumber
104syn match fsOptionsKeywords contained /\<sb=/ nextgroup=fsOptionsNumber
105syn match fsOptionsKeywords contained /\<commit=/ nextgroup=fsOptionsNumber
106syn keyword fsOptionsExt4Journal contained update inum
107syn keyword fsOptionsExt4Data contained journal ordered writeback
108syn match fsOptionsExt4Barrier /[0-1]/
109syn keyword fsOptionsKeywords contained noload extents orlov oldalloc user_xattr nouser_xattr acl noacl reservation noreservation bsddf minixdf check=none nocheck debug grpid nogroupid sysvgroups bsdgroups quota noquota grpquota usrquota bh nobh
110
111" Options: fat
112syn match fsOptionsKeywords contained /\<blocksize=/ nextgroup=fsOptionsSize
113syn match fsOptionsKeywords contained /\<\%([dfu]mask\|codepage\)=/ nextgroup=fsOptionsNumberOctal
114syn match fsOptionsKeywords contained /\%(cvf_\%(format\|option\)\|iocharset\)=/ nextgroup=fsOptionsString
115syn match fsOptionsKeywords contained /\<check=/ nextgroup=@fsOptionsCheckCluster
116syn match fsOptionsKeywords contained /\<conv=*/ nextgroup=fsOptionsConv
117syn match fsOptionsKeywords contained /\<fat=/ nextgroup=fsOptionsFatType
118syn match fsOptionsKeywords contained /\<dotsOK=/ nextgroup=fsOptionsYesNo
119syn keyword fsOptionsFatCheck contained r n s relaxed normal strict
120syn keyword fsOptionsConv contained b t a binary text auto
121syn keyword fsOptionsFatType contained 12 16 32
122syn keyword fsOptionsKeywords contained quiet sys_immutable showexec dots nodots
123
124" Options: hfs
125syn match fsOptionsKeywords contained /\<\%(creator|type\)=/ nextgroup=fsOptionsString
126syn match fsOptionsKeywords contained /\<\%(dir\|file\|\)_umask=/ nextgroup=fsOptionsNumberOctal
127syn match fsOptionsKeywords contained /\<\%(session\|part\)=/ nextgroup=fsOptionsNumber
128
129" Options: ffs
130syn keyword fsOptionsKeyWords contained softdep
131
132" Options: hpfs
133syn match fsOptionsKeywords contained /\<case=/ nextgroup=fsOptionsHpfsCase
134syn keyword fsOptionsHpfsCase contained lower asis
135
136" Options: iso9660
137syn match fsOptionsKeywords contained /\<map=/ nextgroup=fsOptionsIsoMap
138syn match fsOptionsKeywords contained /\<block=/ nextgroup=fsOptionsSize
139syn match fsOptionsKeywords contained /\<\%(session\|sbsector\)=/ nextgroup=fsOptionsNumber
140syn keyword fsOptionsIsoMap contained n o a normal off acorn
141syn keyword fsOptionsKeywords contained norock nojoilet unhide cruft
142syn keyword fsOptionsConv contained m mtext
143
144" Options: jfs
145syn keyword fsOptionsKeywords nointegrity integrity
146
147" Options: nfs
148syn match fsOptionsKeywords contained /\<\%(rsize\|wsize\|timeo\|retrans\|acregmin\|acregmax\|acdirmin\|acdirmax\|actimeo\|retry\|port\|mountport\|mounthost\|mountprog\|mountvers\|nfsprog\|nfsvers\|namelen\)=/ nextgroup=fsOptionsString
149syn keyword fsOptionsKeywords contained bg fg soft hard intr cto ac tcp udp lock nobg nofg nosoft nohard nointr noposix nocto noac notcp noudp nolock
150
151" Options: ntfs
152syn match fsOptionsKeywords contained /\<\%(posix=*\|uni_xlate=\)/ nextgroup=fsOptionsNumber
153syn keyword fsOptionsKeywords contained utf8
154
155" Options: proc
156" -- everything already defined
157
158" Options: reiserfs
159syn match fsOptionsKeywords contained /\<hash=/ nextgroup=fsOptionsReiserHash
160syn match fsOptionsKeywords contained /\<resize=/ nextgroup=fsOptionsNumber
161syn keyword fsOptionsReiserHash contained rupasov tea r5 detect
162syn keyword fsOptionsKeywords contained hashed_relocation noborder nolog notail no_unhashed_relocation replayonly
163
164" Options: sshfs
165syn match fsOptionsKeywords contained /\<\%(BatchMode\|ChallengeResponseAuthentication\|CheckHostIP\|ClearAllForwardings\|Compression\|EnableSSHKeysign\|ForwardAgent\|ForwardX11\|ForwardX11Trusted\|GatewayPorts\|GSSAPIAuthentication\|GSSAPIDelegateCredentials\|HashKnownHosts\|HostbasedAuthentication\|IdentitiesOnly\|NoHostAuthenticationForLocalhost\|PasswordAuthentication\|PubkeyAuthentication\|RhostsRSAAuthentication\|RSAAuthentication\|TCPKeepAlive\|UsePrivilegedPort\|cache\)=/ nextgroup=fsOptionsYesNo
166syn match fsOptionsKeywords contained /\<\%(ControlMaster\|StrictHostKeyChecking\|VerifyHostKeyDNS\)=/ nextgroup=fsOptionsSshYesNoAsk
167syn match fsOptionsKeywords contained /\<\%(AddressFamily\|BindAddress\|Cipher\|Ciphers\|ControlPath\|DynamicForward\|EscapeChar\|GlobalKnownHostsFile\|HostKeyAlgorithms\|HostKeyAlias\|HostName\|IdentityFile\|KbdInteractiveDevices\|LocalForward\|LogLevel\|MACs\|PreferredAuthentications\|Protocol\|ProxyCommand\|RemoteForward\|RhostsAuthentication\|SendEnv\|SmartcardDevice\|User\|UserKnownHostsFile\|XAuthLocation\|comment\|workaround\|idmap\|ssh_command\|sftp_server\|fsname\)=/ nextgroup=fsOptionsString
168syn match fsOptionsKeywords contained /\<\%(CompressionLevel\|ConnectionAttempts\|ConnectTimeout\|NumberOfPasswordPrompts\|Port\|ServerAliveCountMax\|ServerAliveInterval\|cache_timeout\|cache_X_timeout\|ssh_protocol\|directport\|max_read\|umask\|uid\|gid\|entry_timeout\|negative_timeout\|attr_timeout\)=/ nextgroup=fsOptionsNumber
169syn keyword fsOptionsKeywords contained reconnect sshfs_sync no_readahead sshfs_debug transform_symlinks allow_other allow_root nonempty default_permissions large_read hard_remove use_ino readdir_ino direct_io kernel_cache
170syn keyword fsOptionsSshYesNoAsk contained yes no ask
171
172" Options: subfs
173syn match fsOptionsKeywords contained /\<fs=/ nextgroup=fsOptionsString
174syn keyword fsOptionsKeywords contained procuid
175
176" Options: swap
177syn match fsOptionsKeywords contained /\<pri=/ nextgroup=fsOptionsNumber
178
179" Options: tmpfs
180syn match fsOptionsKeywords contained /\<nr_\%(blocks\|inodes\)=/ nextgroup=fsOptionsNumber
181
182" Options: udf
183syn match fsOptionsKeywords contained /\<\%(anchor\|partition\|lastblock\|fileset\|rootdir\)=/ nextgroup=fsOptionsString
184syn keyword fsOptionsKeywords contained unhide undelete strict novrs
185
186" Options: ufs
187syn match fsOptionsKeywords contained /\<ufstype=/ nextgroup=fsOptionsUfsType
188syn match fsOptionsKeywords contained /\<onerror=/ nextgroup=fsOptionsUfsError
189syn keyword fsOptionsUfsType contained old hp 44bsd sun sunx86 nextstep openstep
190syn match fsOptionsUfsType contained /\<nextstep-cd\>/
191syn keyword fsOptionsUfsError contained panic lock umount repair
192
193" Options: usbfs
194syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)\%(id\|gid\)=/ nextgroup=fsOptionsNumber
195syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)mode=/ nextgroup=fsOptionsNumberOctal
196
197" Options: vfat
198syn keyword fsOptionsKeywords contained nonumtail posix utf8
199syn match fsOptionsKeywords contained /shortname=/ nextgroup=fsOptionsVfatShortname
200syn keyword fsOptionsVfatShortname contained lower win95 winnt mixed
201
202" Options: xfs
203syn match fsOptionsKeywords contained /\%(biosize\|logbufs\|logbsize\|logdev\|rtdev\|sunit\|swidth\)=/ nextgroup=fsOptionsString
204syn keyword fsOptionsKeywords contained dmapi xdsm noalign noatime noquota norecovery osyncisdsync quota usrquota uqnoenforce grpquota gqnoenforce
205
206" Frequency / Pass No.
207syn cluster fsFreqPassCluster contains=fsFreqPassNumber,fsFreqPassError
208syn match fsFreqPassError /\s\+\zs\%(\D.*\|\S.*\|\d\+\s\+[^012]\)\ze/ contained
209syn match fsFreqPassNumber /\d\+\s\+[012]\s*/ contained
210
211" Groups
212syn match fsDevice /^\s*\zs.\{-1,}\s/me=e-1 nextgroup=fsMountPoint contains=@fsDeviceCluster,@fsGeneralCluster
213syn match fsMountPoint /\s\+.\{-}\s/me=e-1 nextgroup=fsType contains=@fsMountPointCluster,@fsGeneralCluster contained
214syn match fsType /\s\+.\{-}\s/me=e-1 nextgroup=fsOptions contains=@fsTypeCluster,@fsGeneralCluster contained
215syn match fsOptions /\s\+.\{-}\s/me=e-1 nextgroup=fsFreqPass contains=@fsOptionsCluster,@fsGeneralCluster contained
216syn match fsFreqPass /\s\+.\{-}$/ contains=@fsFreqPassCluster,@fsGeneralCluster contained
217
218" Whole line comments
219syn match fsCommentLine /^#.*$/
220
221if version >= 508 || !exists("did_config_syntax_inits")
222	if version < 508
223		let did_config_syntax_inits = 1
224		command! -nargs=+ HiLink hi link <args>
225	else
226		command! -nargs=+ HiLink hi def link <args>
227	endif
228
229	HiLink fsOperator Operator
230	HiLink fsComment Comment
231	HiLink fsCommentLine Comment
232
233	HiLink fsTypeKeyword Type
234	HiLink fsDeviceKeyword Identifier
235	HiLink fsDeviceLabel String
236	HiLink fsDeviceUUID String
237	HiLink fsDeviceSshfs String
238	HiLink fsFreqPassNumber Number
239
240	if exists('fstab_unknown_fs_errors') && fstab_unknown_fs_errors == 1
241		HiLink fsTypeUnknown Error
242	endif
243
244	HiLink fsDeviceError Error
245	HiLink fsMountPointError Error
246	HiLink fsMountPointKeyword Keyword
247	HiLink fsFreqPassError Error
248
249	HiLink fsOptionsGeneral Type
250	HiLink fsOptionsKeywords Keyword
251	HiLink fsOptionsNumber Number
252	HiLink fsOptionsNumberOctal Number
253	HiLink fsOptionsString String
254	HiLink fsOptionsSize Number
255	HiLink fsOptionsExt2Check String
256	HiLink fsOptionsExt2Errors String
257	HiLink fsOptionsExt3Journal String
258	HiLink fsOptionsExt3Data String
259	HiLink fsOptionsExt4Journal String
260	HiLink fsOptionsExt4Data String
261	HiLink fsOptionsExt4Barrier Number
262	HiLink fsOptionsFatCheck String
263	HiLink fsOptionsConv String
264	HiLink fsOptionsFatType Number
265	HiLink fsOptionsYesNo String
266	HiLink fsOptionsHpfsCase String
267	HiLink fsOptionsIsoMap String
268	HiLink fsOptionsReiserHash String
269	HiLink fsOptionsSshYesNoAsk String
270	HiLink fsOptionsUfsType String
271	HiLink fsOptionsUfsError String
272
273	HiLink fsOptionsVfatShortname String
274
275	delcommand HiLink
276endif
277
278let b:current_syntax = "fstab"
279
280" vim: ts=8 ft=vim
281