blob: 830b8d014d28b55c146d189aa728c3e162e3a2e9 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaarb21e5842006-04-16 18:30:08 +00002" Language: fstab file
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +00003" Maintaner: Radu Dineiu <radu.dineiu@gmail.com>
4" URL: http://ld.yi.org/vim/fstab.vim
Bram Moolenaarf2330482008-06-24 20:19:36 +00005" Last Change: 2008 Jan 16
6" Version: 0.92
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +00007"
8" Credits:
9" David Necas (Yeti) <yeti@physics.muni.cz>
10" Stefano Zacchiroli <zack@debian.org>
11" Georgi Georgiev <chutz@gg3.net>
Bram Moolenaarf2330482008-06-24 20:19:36 +000012" James Vega <jamessan@debian.org>
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000013"
14" Options:
15" let fstab_unknown_fs_errors = 1
16" highlight unknown filesystems as errors
Bram Moolenaar071d4272004-06-13 20:20:40 +000017
18if version < 600
19 syntax clear
20elseif exists("b:current_syntax")
21 finish
22endif
23
24" General
25syn cluster fsGeneralCluster contains=fsComment
26syn match fsComment /\s*#.*/
Bram Moolenaarf2330482008-06-24 20:19:36 +000027syn match fsOperator /[,=:#]/
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
29" Device
30syn cluster fsDeviceCluster contains=fsOperator,fsDeviceKeyword,fsDeviceError
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000031syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained
Bram Moolenaarb21e5842006-04-16 18:30:08 +000032syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts sysfs usbfs
Bram Moolenaar071d4272004-06-13 20:20:40 +000033syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000034syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID
Bram Moolenaarf2330482008-06-24 20:19:36 +000035syn keyword fsDeviceKeyword contained sshfs nextgroup=fsDeviceSshfs
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000036syn match fsDeviceKeyword contained /^[a-zA-Z0-9.\-]\+\ze:/
Bram Moolenaar071d4272004-06-13 20:20:40 +000037syn match fsDeviceLabel contained /=[^ \t]\+/hs=s+1 contains=fsOperator
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000038syn match fsDeviceUUID contained /=[^ \t]\+/hs=s+1 contains=fsOperator
Bram Moolenaarf2330482008-06-24 20:19:36 +000039syn match fsDeviceSshfs contained /#[_=[:alnum:]\.\/+-]\+@[a-z0-9._-]\+\a\{2}:[^ \t]\+/hs=s+1 contains=fsOperator
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
41" Mount Point
42syn cluster fsMountPointCluster contains=fsMountPointKeyword,fsMountPointError
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000043syn match fsMountPointError /\%([^ \ta-zA-Z0-9_\/#@\.-]\|\s\+\zs\w\{-}\ze\s\)/ contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000044syn keyword fsMountPointKeyword contained none swap
45
46" Type
Bram Moolenaarb21e5842006-04-16 18:30:08 +000047syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown
48syn match fsTypeUnknown /\s\+\zs\w\+/ contained
Bram Moolenaarf2330482008-06-24 20:19:36 +000049syn 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 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000050
51" Options
52" -------
53" Options: General
Bram Moolenaarb21e5842006-04-16 18:30:08 +000054syn cluster fsOptionsCluster contains=fsOperator,fsOptionsGeneral,fsOptionsKeywords,fsTypeUnknown
Bram Moolenaar071d4272004-06-13 20:20:40 +000055syn match fsOptionsNumber /\d\+/
56syn match fsOptionsNumberOctal /[0-8]\+/
57syn match fsOptionsString /[a-zA-Z0-9_-]\+/
58syn keyword fsOptionsYesNo yes no
59syn cluster fsOptionsCheckCluster contains=fsOptionsExt2Check,fsOptionsFatCheck
60syn keyword fsOptionsSize 512 1024 2048
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +000061syn 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000062syn match fsOptionsGeneral /_netdev/
63
64" Options: adfs
Bram Moolenaarb21e5842006-04-16 18:30:08 +000065syn match fsOptionsKeywords contained /\<\%([ug]id\|o\%(wn\|th\)mask\)=/ nextgroup=fsOptionsNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +000066
67" Options: affs
Bram Moolenaarb21e5842006-04-16 18:30:08 +000068syn match fsOptionsKeywords contained /\<\%(set[ug]id\|mode\|reserved\)=/ nextgroup=fsOptionsNumber
69syn match fsOptionsKeywords contained /\<\%(prefix\|volume\|root\)=/ nextgroup=fsOptionsString
70syn match fsOptionsKeywords contained /\<bs=/ nextgroup=fsOptionsSize
Bram Moolenaar071d4272004-06-13 20:20:40 +000071syn keyword fsOptionsKeywords contained protect usemp verbose
72
73" Options: cd9660
74syn keyword fsOptionsKeywords contained extatt gens norrip nostrictjoilet
75
76" Options: devpts
77" -- everything already defined
78
79" Options: ext2
Bram Moolenaarb21e5842006-04-16 18:30:08 +000080syn match fsOptionsKeywords contained /\<check=*/ nextgroup=@fsOptionsCheckCluster
81syn match fsOptionsKeywords contained /\<errors=/ nextgroup=fsOptionsExt2Errors
82syn match fsOptionsKeywords contained /\<\%(res[gu]id\|sb\)=/ nextgroup=fsOptionsNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +000083syn keyword fsOptionsExt2Check contained none normal strict
84syn keyword fsOptionsExt2Errors contained continue panic
Bram Moolenaarb21e5842006-04-16 18:30:08 +000085syn match fsOptionsExt2Errors contained /\<remount-ro\>/
86syn keyword fsOptionsKeywords contained acl bsddf minixdf debug grpid bsdgroups minixdf noacl nocheck nogrpid oldalloc orlov sysvgroups nouid32 nobh user_xattr nouser_xattr
Bram Moolenaar071d4272004-06-13 20:20:40 +000087
88" Options: ext3
Bram Moolenaarb21e5842006-04-16 18:30:08 +000089syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt3Journal
90syn match fsOptionsKeywords contained /\<data=/ nextgroup=fsOptionsExt3Data
91syn match fsOptionsKeywords contained /\<commit=/ nextgroup=fsOptionsNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +000092syn keyword fsOptionsExt3Journal contained update inum
93syn keyword fsOptionsExt3Data contained journal ordered writeback
94syn keyword fsOptionsKeywords contained noload
95
96" Options: fat
Bram Moolenaarb21e5842006-04-16 18:30:08 +000097syn match fsOptionsKeywords contained /\<blocksize=/ nextgroup=fsOptionsSize
98syn match fsOptionsKeywords contained /\<\%([dfu]mask\|codepage\)=/ nextgroup=fsOptionsNumberOctal
Bram Moolenaar071d4272004-06-13 20:20:40 +000099syn match fsOptionsKeywords contained /\%(cvf_\%(format\|option\)\|iocharset\)=/ nextgroup=fsOptionsString
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000100syn match fsOptionsKeywords contained /\<check=/ nextgroup=@fsOptionsCheckCluster
101syn match fsOptionsKeywords contained /\<conv=*/ nextgroup=fsOptionsConv
102syn match fsOptionsKeywords contained /\<fat=/ nextgroup=fsOptionsFatType
103syn match fsOptionsKeywords contained /\<dotsOK=/ nextgroup=fsOptionsYesNo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104syn keyword fsOptionsFatCheck contained r n s relaxed normal strict
105syn keyword fsOptionsConv contained b t a binary text auto
106syn keyword fsOptionsFatType contained 12 16 32
107syn keyword fsOptionsKeywords contained quiet sys_immutable showexec dots nodots
108
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000109" Options: hfs
110syn match fsOptionsKeywords contained /\<\%(creator|type\)=/ nextgroup=fsOptionsString
111syn match fsOptionsKeywords contained /\<\%(dir\|file\|\)_umask=/ nextgroup=fsOptionsNumberOctal
112syn match fsOptionsKeywords contained /\<\%(session\|part\)=/ nextgroup=fsOptionsNumber
113
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +0000114" Options: ffs
115syn keyword fsOptionsKeyWords contained softdep
116
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117" Options: hpfs
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000118syn match fsOptionsKeywords contained /\<case=/ nextgroup=fsOptionsHpfsCase
Bram Moolenaar071d4272004-06-13 20:20:40 +0000119syn keyword fsOptionsHpfsCase contained lower asis
120
121" Options: iso9660
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000122syn match fsOptionsKeywords contained /\<map=/ nextgroup=fsOptionsIsoMap
123syn match fsOptionsKeywords contained /\<block=/ nextgroup=fsOptionsSize
124syn match fsOptionsKeywords contained /\<\%(session\|sbsector\)=/ nextgroup=fsOptionsNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +0000125syn keyword fsOptionsIsoMap contained n o a normal off acorn
126syn keyword fsOptionsKeywords contained norock nojoilet unhide cruft
127syn keyword fsOptionsConv contained m mtext
128
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000129" Options: jfs
130syn keyword fsOptionsKeywords nointegrity integrity
131
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132" Options: nfs
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000133syn match fsOptionsKeywords contained /\<\%(rsize\|wsize\|timeo\|retrans\|acregmin\|acregmax\|acdirmin\|acdirmax\|actimeo\|retry\|port\|mountport\|mounthost\|mountprog\|mountvers\|nfsprog\|nfsvers\|namelen\)=/ nextgroup=fsOptionsString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134syn keyword fsOptionsKeywords contained bg fg soft hard intr cto ac tcp udp lock nobg nofg nosoft nohard nointr noposix nocto noac notcp noudp nolock
135
136" Options: ntfs
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000137syn match fsOptionsKeywords contained /\<\%(posix=*\|uni_xlate=\)/ nextgroup=fsOptionsNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138syn keyword fsOptionsKeywords contained utf8
139
140" Options: proc
141" -- everything already defined
142
143" Options: reiserfs
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000144syn match fsOptionsKeywords contained /\<hash=/ nextgroup=fsOptionsReiserHash
145syn match fsOptionsKeywords contained /\<resize=/ nextgroup=fsOptionsNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +0000146syn keyword fsOptionsReiserHash contained rupasov tea r5 detect
147syn keyword fsOptionsKeywords contained hashed_relocation noborder nolog notail no_unhashed_relocation replayonly
148
Bram Moolenaarf2330482008-06-24 20:19:36 +0000149" Options: sshfs
150syn 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
151syn match fsOptionsKeywords contained /\<\%(ControlMaster\|StrictHostKeyChecking\|VerifyHostKeyDNS\)=/ nextgroup=fsOptionsSshYesNoAsk
152syn 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
153syn 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
154syn 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
155syn keyword fsOptionsSshYesNoAsk contained yes no ask
156
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000157" Options: subfs
158syn match fsOptionsKeywords contained /\<fs=/ nextgroup=fsOptionsString
159syn keyword fsOptionsKeywords contained procuid
160
161" Options: swap
162syn match fsOptionsKeywords contained /\<pri=/ nextgroup=fsOptionsNumber
163
164" Options: tmpfs
165syn match fsOptionsKeywords contained /\<nr_\%(blocks\|inodes\)=/ nextgroup=fsOptionsNumber
166
Bram Moolenaar071d4272004-06-13 20:20:40 +0000167" Options: udf
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000168syn match fsOptionsKeywords contained /\<\%(anchor\|partition\|lastblock\|fileset\|rootdir\)=/ nextgroup=fsOptionsString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169syn keyword fsOptionsKeywords contained unhide undelete strict novrs
170
171" Options: ufs
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000172syn match fsOptionsKeywords contained /\<ufstype=/ nextgroup=fsOptionsUfsType
173syn match fsOptionsKeywords contained /\<onerror=/ nextgroup=fsOptionsUfsError
174syn keyword fsOptionsUfsType contained old hp 44bsd sun sunx86 nextstep openstep
175syn match fsOptionsUfsType contained /\<nextstep-cd\>/
Bram Moolenaar071d4272004-06-13 20:20:40 +0000176syn keyword fsOptionsUfsError contained panic lock umount repair
177
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000178" Options: usbfs
179syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)\%(id\|gid\)=/ nextgroup=fsOptionsNumber
180syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)mode=/ nextgroup=fsOptionsNumberOctal
181
Bram Moolenaar071d4272004-06-13 20:20:40 +0000182" Options: vfat
183syn keyword fsOptionsKeywords contained nonumtail posix utf8
184syn match fsOptionsKeywords contained /shortname=/ nextgroup=fsOptionsVfatShortname
185syn keyword fsOptionsVfatShortname contained lower win95 winnt mixed
186
187" Options: xfs
188syn match fsOptionsKeywords contained /\%(biosize\|logbufs\|logbsize\|logdev\|rtdev\|sunit\|swidth\)=/ nextgroup=fsOptionsString
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000189syn keyword fsOptionsKeywords contained dmapi xdsm noalign noatime noquota norecovery osyncisdsync quota usrquota uqnoenforce grpquota gqnoenforce
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190
191" Frequency / Pass No.
192syn cluster fsFreqPassCluster contains=fsFreqPassNumber,fsFreqPassError
193syn match fsFreqPassError /\s\+\zs\%(\D.*\|\S.*\|\d\+\s\+[^012]\)\ze/ contained
194syn match fsFreqPassNumber /\d\+\s\+[012]\s*/ contained
195
196" Groups
197syn match fsDevice /^\s*\zs.\{-1,}\s/me=e-1 nextgroup=fsMountPoint contains=@fsDeviceCluster,@fsGeneralCluster
198syn match fsMountPoint /\s\+.\{-}\s/me=e-1 nextgroup=fsType contains=@fsMountPointCluster,@fsGeneralCluster contained
199syn match fsType /\s\+.\{-}\s/me=e-1 nextgroup=fsOptions contains=@fsTypeCluster,@fsGeneralCluster contained
200syn match fsOptions /\s\+.\{-}\s/me=e-1 nextgroup=fsFreqPass contains=@fsOptionsCluster,@fsGeneralCluster contained
201syn match fsFreqPass /\s\+.\{-}$/ contains=@fsFreqPassCluster,@fsGeneralCluster contained
202
203" Whole line comments
204syn match fsCommentLine /^#.*$/
205
206if version >= 508 || !exists("did_config_syntax_inits")
207 if version < 508
208 let did_config_syntax_inits = 1
209 command! -nargs=+ HiLink hi link <args>
210 else
211 command! -nargs=+ HiLink hi def link <args>
212 endif
213
214 HiLink fsOperator Operator
215 HiLink fsComment Comment
216 HiLink fsCommentLine Comment
217
218 HiLink fsTypeKeyword Type
219 HiLink fsDeviceKeyword Identifier
220 HiLink fsDeviceLabel String
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +0000221 HiLink fsDeviceUUID String
Bram Moolenaarf2330482008-06-24 20:19:36 +0000222 HiLink fsDeviceSshfs String
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223 HiLink fsFreqPassNumber Number
224
Bram Moolenaardd2a3cd2007-05-05 17:10:09 +0000225 if exists('fstab_unknown_fs_errors') && fstab_unknown_fs_errors == 1
Bram Moolenaarb21e5842006-04-16 18:30:08 +0000226 HiLink fsTypeUnknown Error
227 endif
Bram Moolenaarf2330482008-06-24 20:19:36 +0000228
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229 HiLink fsDeviceError Error
230 HiLink fsMountPointError Error
231 HiLink fsMountPointKeyword Keyword
232 HiLink fsFreqPassError Error
233
234 HiLink fsOptionsGeneral Type
235 HiLink fsOptionsKeywords Keyword
236 HiLink fsOptionsNumber Number
237 HiLink fsOptionsNumberOctal Number
238 HiLink fsOptionsString String
239 HiLink fsOptionsSize Number
240 HiLink fsOptionsExt2Check String
241 HiLink fsOptionsExt2Errors String
242 HiLink fsOptionsExt3Journal String
243 HiLink fsOptionsExt3Data String
244 HiLink fsOptionsFatCheck String
245 HiLink fsOptionsConv String
246 HiLink fsOptionsFatType Number
247 HiLink fsOptionsYesNo String
248 HiLink fsOptionsHpfsCase String
249 HiLink fsOptionsIsoMap String
250 HiLink fsOptionsReiserHash String
Bram Moolenaarf2330482008-06-24 20:19:36 +0000251 HiLink fsOptionsSshYesNoAsk String
Bram Moolenaar071d4272004-06-13 20:20:40 +0000252 HiLink fsOptionsUfsType String
253 HiLink fsOptionsUfsError String
254
255 HiLink fsOptionsVfatShortname String
256
257 delcommand HiLink
258endif
259
260let b:current_syntax = "fstab"
261
262" vim: ts=8 ft=vim