vim-patch:f66674c: runtime(fstab): Added mtab support to fstab syntax.

closes: vim/vim#18074

f66674cf42

Co-authored-by: Radu Dineiu <radu.dineiu@gmail.com>
This commit is contained in:
zeertzjq
2025-08-24 20:07:57 +08:00
parent 523371b044
commit 53802da38b
2 changed files with 35 additions and 5 deletions

View File

@@ -2,10 +2,11 @@
" Language: fstab file " Language: fstab file
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com> " Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim " URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim
" Last Change: 2025 Mar 31 " Last Change: 2025 Aug 21
" Version: 1.0.1 " Version: 1.1.0
" "
" Changelog: " Changelog:
" - 2025 Aug 21 added support for mtab
" - 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') " - 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" - 2025 Mar 31 added setlocal formatoptions-=t " - 2025 Mar 31 added setlocal formatoptions-=t
" "
@@ -20,6 +21,10 @@ let b:did_ftplugin = 1
setlocal commentstring=#\ %s setlocal commentstring=#\ %s
setlocal formatoptions-=t setlocal formatoptions-=t
let b:undo_ftplugin = "setlocal commentstring< formatoptions<" if expand('%:t') == 'mtab'
let b:fstab_enable_mtab = 1
endif
let b:undo_ftplugin = "setlocal commentstring< | setlocal formatoptions<"
" vim: ts=8 ft=vim " vim: ts=8 ft=vim

View File

@@ -2,8 +2,8 @@
" Language: fstab file " Language: fstab file
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com> " Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-fstab/master/syntax/fstab.vim " URL: https://raw.github.com/rid9/vim-fstab/master/syntax/fstab.vim
" Last Change: 2024 Jul 11 " Last Change: 2025 Aug 21
" Version: 1.6.4 " Version: 1.7.0
" "
" Credits: " Credits:
" David Necas (Yeti) <yeti@physics.muni.cz> " David Necas (Yeti) <yeti@physics.muni.cz>
@@ -18,6 +18,9 @@
" "
" let fstab_unknown_device_errors = 0 " let fstab_unknown_device_errors = 0
" do not highlight unknown devices as errors " do not highlight unknown devices as errors
"
" Changelog:
" - 2025 Aug 21 added support for mtab
" quit when a syntax file was already loaded " quit when a syntax file was already loaded
if exists("b:current_syntax") if exists("b:current_syntax")
@@ -402,6 +405,28 @@ syn match fsFreqPass /\s\+.\{-}$/ contains=@fsFreqPassCluster,@fsGeneralCluster
" Whole line comments " Whole line comments
syn match fsCommentLine /^#.*$/ contains=@Spell syn match fsCommentLine /^#.*$/ contains=@Spell
if exists('b:fstab_enable_mtab') && b:fstab_enable_mtab == 1
" mtab
" ----
syn keyword fsDeviceKeyword contained binfmt_misc bpf cgroup2 configfs debugfs efivarfs fusectl hugetlbfs mqueue portal pstore securityfs udev ramfs
syn match fsDeviceKeyword contained /^systemd-1/
syn match fsDeviceKeyword contained /^\/dev\S\+/
" devpts
syn match fsOptionsKeywords contained /\<ptmxmode=/ nextgroup=fsOptionsNumber
" cgroup2
syn keyword fsTypeKeyword contained cgroup2
syn keyword fsOptionsKeywords contained nsdelegate memory_recursiveprot
" hugetlbfs
syn match fsOptionsKeywords contained /\<pagesize=/ nextgroup=fsOptionsString
" systemd
syn match fsOptionsKeywords contained /\<\%(pgrp\|timeout\|minproto\|maxproto\|pipe_ino\)=/ nextgroup=fsOptionsNumber
syn keyword fsOptionsKeywords contained direct
endif
hi def link fsOperator Operator hi def link fsOperator Operator
hi def link fsComment Comment hi def link fsComment Comment
hi def link fsCommentLine Comment hi def link fsCommentLine Comment