Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 2 | " Language: fstab file |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 3 | " Maintaner: Radu Dineiu <radu.dineiu@gmail.com> |
| 4 | " URL: http://ld.yi.org/vim/fstab.vim |
| 5 | " Last Change: 2007 Apr 24 |
| 6 | " Version: 0.91 |
| 7 | " |
| 8 | " Credits: |
| 9 | " David Necas (Yeti) <yeti@physics.muni.cz> |
| 10 | " Stefano Zacchiroli <zack@debian.org> |
| 11 | " Georgi Georgiev <chutz@gg3.net> |
| 12 | " |
| 13 | " Options: |
| 14 | " let fstab_unknown_fs_errors = 1 |
| 15 | " highlight unknown filesystems as errors |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 16 | |
| 17 | if version < 600 |
| 18 | syntax clear |
| 19 | elseif exists("b:current_syntax") |
| 20 | finish |
| 21 | endif |
| 22 | |
| 23 | " General |
| 24 | syn cluster fsGeneralCluster contains=fsComment |
| 25 | syn match fsComment /\s*#.*/ |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 26 | syn match fsOperator /[,=:]/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 27 | |
| 28 | " Device |
| 29 | syn cluster fsDeviceCluster contains=fsOperator,fsDeviceKeyword,fsDeviceError |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 30 | syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 31 | syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts sysfs usbfs |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 32 | syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 33 | syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID |
| 34 | syn match fsDeviceKeyword contained /^[a-zA-Z0-9.\-]\+\ze:/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 35 | syn match fsDeviceLabel contained /=[^ \t]\+/hs=s+1 contains=fsOperator |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 36 | syn match fsDeviceUUID contained /=[^ \t]\+/hs=s+1 contains=fsOperator |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | |
| 38 | " Mount Point |
| 39 | syn cluster fsMountPointCluster contains=fsMountPointKeyword,fsMountPointError |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 40 | syn match fsMountPointError /\%([^ \ta-zA-Z0-9_\/#@\.-]\|\s\+\zs\w\{-}\ze\s\)/ contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 41 | syn keyword fsMountPointKeyword contained none swap |
| 42 | |
| 43 | " Type |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 44 | syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown |
| 45 | syn match fsTypeUnknown /\s\+\zs\w\+/ contained |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 47 | |
| 48 | " Options |
| 49 | " ------- |
| 50 | " Options: General |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 51 | syn cluster fsOptionsCluster contains=fsOperator,fsOptionsGeneral,fsOptionsKeywords,fsTypeUnknown |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 59 | syn match fsOptionsGeneral /_netdev/ |
| 60 | |
| 61 | " Options: adfs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 62 | syn match fsOptionsKeywords contained /\<\%([ug]id\|o\%(wn\|th\)mask\)=/ nextgroup=fsOptionsNumber |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 63 | |
| 64 | " Options: affs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 68 | syn keyword fsOptionsKeywords contained protect usemp verbose |
| 69 | |
| 70 | " Options: cd9660 |
| 71 | syn keyword fsOptionsKeywords contained extatt gens norrip nostrictjoilet |
| 72 | |
| 73 | " Options: devpts |
| 74 | " -- everything already defined |
| 75 | |
| 76 | " Options: ext2 |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 80 | syn keyword fsOptionsExt2Check contained none normal strict |
| 81 | syn keyword fsOptionsExt2Errors contained continue panic |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 84 | |
| 85 | " Options: ext3 |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 86 | syn match fsOptionsKeywords contained /\<journal=/ nextgroup=fsOptionsExt3Journal |
| 87 | syn match fsOptionsKeywords contained /\<data=/ nextgroup=fsOptionsExt3Data |
| 88 | syn match fsOptionsKeywords contained /\<commit=/ nextgroup=fsOptionsNumber |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 89 | syn keyword fsOptionsExt3Journal contained update inum |
| 90 | syn keyword fsOptionsExt3Data contained journal ordered writeback |
| 91 | syn keyword fsOptionsKeywords contained noload |
| 92 | |
| 93 | " Options: fat |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 94 | syn match fsOptionsKeywords contained /\<blocksize=/ nextgroup=fsOptionsSize |
| 95 | syn match fsOptionsKeywords contained /\<\%([dfu]mask\|codepage\)=/ nextgroup=fsOptionsNumberOctal |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 96 | syn match fsOptionsKeywords contained /\%(cvf_\%(format\|option\)\|iocharset\)=/ nextgroup=fsOptionsString |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 |
| 105 | |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 106 | " Options: hfs |
| 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 |
| 110 | |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 111 | " Options: ffs |
| 112 | syn keyword fsOptionsKeyWords contained softdep |
| 113 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 114 | " Options: hpfs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 115 | syn match fsOptionsKeywords contained /\<case=/ nextgroup=fsOptionsHpfsCase |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 116 | syn keyword fsOptionsHpfsCase contained lower asis |
| 117 | |
| 118 | " Options: iso9660 |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 |
| 125 | |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 126 | " Options: jfs |
| 127 | syn keyword fsOptionsKeywords nointegrity integrity |
| 128 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 129 | " Options: nfs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 |
| 132 | |
| 133 | " Options: ntfs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 134 | syn match fsOptionsKeywords contained /\<\%(posix=*\|uni_xlate=\)/ nextgroup=fsOptionsNumber |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 135 | syn keyword fsOptionsKeywords contained utf8 |
| 136 | |
| 137 | " Options: proc |
| 138 | " -- everything already defined |
| 139 | |
| 140 | " Options: reiserfs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 141 | syn match fsOptionsKeywords contained /\<hash=/ nextgroup=fsOptionsReiserHash |
| 142 | syn match fsOptionsKeywords contained /\<resize=/ nextgroup=fsOptionsNumber |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 143 | syn keyword fsOptionsReiserHash contained rupasov tea r5 detect |
| 144 | syn keyword fsOptionsKeywords contained hashed_relocation noborder nolog notail no_unhashed_relocation replayonly |
| 145 | |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 146 | " Options: subfs |
| 147 | syn match fsOptionsKeywords contained /\<fs=/ nextgroup=fsOptionsString |
| 148 | syn keyword fsOptionsKeywords contained procuid |
| 149 | |
| 150 | " Options: swap |
| 151 | syn match fsOptionsKeywords contained /\<pri=/ nextgroup=fsOptionsNumber |
| 152 | |
| 153 | " Options: tmpfs |
| 154 | syn match fsOptionsKeywords contained /\<nr_\%(blocks\|inodes\)=/ nextgroup=fsOptionsNumber |
| 155 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 156 | " Options: udf |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 157 | syn match fsOptionsKeywords contained /\<\%(anchor\|partition\|lastblock\|fileset\|rootdir\)=/ nextgroup=fsOptionsString |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 158 | syn keyword fsOptionsKeywords contained unhide undelete strict novrs |
| 159 | |
| 160 | " Options: ufs |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 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\>/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 165 | syn keyword fsOptionsUfsError contained panic lock umount repair |
| 166 | |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 167 | " Options: usbfs |
| 168 | syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)\%(id\|gid\)=/ nextgroup=fsOptionsNumber |
| 169 | syn match fsOptionsKeywords contained /\<\%(dev\|bus\|list\)mode=/ nextgroup=fsOptionsNumberOctal |
| 170 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 171 | " Options: vfat |
| 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 |
| 175 | |
| 176 | " Options: xfs |
| 177 | syn match fsOptionsKeywords contained /\%(biosize\|logbufs\|logbsize\|logdev\|rtdev\|sunit\|swidth\)=/ nextgroup=fsOptionsString |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 178 | syn keyword fsOptionsKeywords contained dmapi xdsm noalign noatime noquota norecovery osyncisdsync quota usrquota uqnoenforce grpquota gqnoenforce |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 179 | |
| 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 |
| 184 | |
| 185 | " Groups |
| 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 |
| 191 | |
| 192 | " Whole line comments |
| 193 | syn match fsCommentLine /^#.*$/ |
| 194 | |
| 195 | if version >= 508 || !exists("did_config_syntax_inits") |
| 196 | if version < 508 |
| 197 | let did_config_syntax_inits = 1 |
| 198 | command! -nargs=+ HiLink hi link <args> |
| 199 | else |
| 200 | command! -nargs=+ HiLink hi def link <args> |
| 201 | endif |
| 202 | |
| 203 | HiLink fsOperator Operator |
| 204 | HiLink fsComment Comment |
| 205 | HiLink fsCommentLine Comment |
| 206 | |
| 207 | HiLink fsTypeKeyword Type |
| 208 | HiLink fsDeviceKeyword Identifier |
| 209 | HiLink fsDeviceLabel String |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 210 | HiLink fsDeviceUUID String |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 211 | HiLink fsFreqPassNumber Number |
| 212 | |
Bram Moolenaar | dd2a3cd | 2007-05-05 17:10:09 +0000 | [diff] [blame] | 213 | if exists('fstab_unknown_fs_errors') && fstab_unknown_fs_errors == 1 |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 214 | HiLink fsTypeUnknown Error |
| 215 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 216 | HiLink fsDeviceError Error |
| 217 | HiLink fsMountPointError Error |
| 218 | HiLink fsMountPointKeyword Keyword |
| 219 | HiLink fsFreqPassError Error |
| 220 | |
| 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 |
| 240 | |
| 241 | HiLink fsOptionsVfatShortname String |
| 242 | |
| 243 | delcommand HiLink |
| 244 | endif |
| 245 | |
| 246 | let b:current_syntax = "fstab" |
| 247 | |
| 248 | " vim: ts=8 ft=vim |