diff --git a/runtime/ftplugin/codeowners.vim b/runtime/ftplugin/codeowners.vim new file mode 100644 index 0000000000..f1dad0d880 --- /dev/null +++ b/runtime/ftplugin/codeowners.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin +" Language: codeowners +" Maintainer: Jon Parise +" Last Change: 2025 Sep 14 +" +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setl comments=:# commentstring=#\ %s +setl formatoptions-=t formatoptions+=croql + +let b:undo_ftplugin = 'setl com< cms< fo<' diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index ffc6c98da5..f1beff1558 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1516,6 +1516,7 @@ local filename = { ['.trans'] = 'clojure', ['CMakeLists.txt'] = 'cmake', ['CMakeCache.txt'] = 'cmakecache', + ['CODEOWNERS'] = 'codeowners', ['.cling_history'] = 'cpp', ['.alias'] = detect.csh, ['.cshrc'] = detect.csh, diff --git a/runtime/syntax/codeowners.vim b/runtime/syntax/codeowners.vim new file mode 100644 index 0000000000..7370220b7a --- /dev/null +++ b/runtime/syntax/codeowners.vim @@ -0,0 +1,23 @@ +" Vim syntax file +" Language: codeowners +" Maintainer: Jon Parise +" Last Change: 2025 Sep 14 + +if exists('b:current_syntax') + finish +endif + +" Comments +syn match codeownersComment /#.*$/ contains=codeownersTodo,@Spell +syn keyword codeownersTodo TODO FIXME XXX contained + +" Patterns +syn match codeownersPattern /^#\@![^#]*/ contains=codeownersGlob +syn match codeownersGlob /^\S\+/ contained nextgroup=codeownersOwner skipwhite +syn match codeownersOwner /\S\+/ contained nextgroup=codeownersOwner skipwhite + +hi def link codeownersComment Comment +hi def link codeownersOwner Identifier +hi def link codeownersTodo Todo + +let b:current_syntax = 'codeowners' diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 6855e1359b..533e09befb 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -189,6 +189,7 @@ func s:GetFilenameChecks() abort \ 'cmusrc': ['any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme', '/.cmus/autosave', '/.cmus/command-history', '/.cmus/file.theme', '/.cmus/rc', '/cmus/file.theme', '/cmus/rc'], \ 'cobol': ['file.cbl', 'file.cob'], \ 'coco': ['file.atg'], + \ 'codeowners': ['CODEOWNERS'], \ 'conaryrecipe': ['file.recipe'], \ 'conf': ['auto.master', 'file.conf', 'texdoc.cnf', '.x11vncrc', '.chktexrc', '.ripgreprc', 'ripgreprc', 'file.ctags'], \ 'config': ['/etc/hostname.file', 'any/etc/hostname.file', 'configure.in', 'configure.ac', 'file.at', 'aclocal.m4'],