patch 9.1.1764: filetype: CODEOWNERS file not recognized

Problem:  filetype: CODEOWNERS file not recognized
Solution: Detect CODEOWNERS file as codeowners filetype, include a
          syntax and filetype plugin (Jon Parise).

CODEOWNERS files define code ownership rules for GitHub-hosted (and
other) repositories. The syntax is similar to 'gitignore' files but
differs in enough ways to warrant its own filetype.

References:
- https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

closes: #18299

Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Jon Parise
2025-09-15 19:35:47 +00:00
committed by Christian Brabandt
parent a946ccf5ff
commit 817e4d3ee6
8 changed files with 79 additions and 0 deletions

4
.github/MAINTAINERS vendored
View File

@ -136,6 +136,7 @@ runtime/ftplugin/chatito.vim @ObserverOfTime
runtime/ftplugin/chicken.vim @evhan
runtime/ftplugin/clojure.vim @axvr
runtime/ftplugin/cmakecache.vim @ribru17
runtime/ftplugin/codeowners.vim @jparise
runtime/ftplugin/cook.vim @ribru17
runtime/ftplugin/cs.vim @nickspoons
runtime/ftplugin/csh.vim @dkearns
@ -456,6 +457,7 @@ runtime/syntax/chatito.vim @ObserverOfTime
runtime/syntax/chicken.vim @evhan
runtime/syntax/chuck.vim @andreacfromtheapp
runtime/syntax/clojure.vim @axvr
runtime/syntax/codeowners.vim @jparise
runtime/syntax/cs.vim @nickspoons
runtime/syntax/csv.vim @habamax
runtime/syntax/cucumber.vim @tpope
@ -686,3 +688,5 @@ src/po/sr.po @eevan78
src/po/tr.po @bitigchi
src/po/uk.po @sakhnik
src/xxd/ @jnweiger
# vim:ft=codeowners

View File

@ -398,6 +398,9 @@ au BufNewFile,BufRead *.ck setf chuck
" Comshare Dimension Definition Language
au BufNewFile,BufRead *.cdl setf cdl
" Codeowners
au BufNewFile,BufRead CODEOWNERS setf codeowners
" Conary Recipe
au BufNewFile,BufRead *.recipe setf conaryrecipe

View File

@ -0,0 +1,14 @@
" Vim filetype plugin
" Language: codeowners
" Maintainer: Jon Parise <jon@indelible.org>
" 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<'

View File

@ -0,0 +1,23 @@
" Vim syntax file
" Language: codeowners
" Maintainer: Jon Parise <jon@indelible.org>
" 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'

View File

@ -0,0 +1,20 @@
>#+0#0000e05#ffffff0| |T|h|i|s| |i|s| |a| |c|o|m@1|e|n|t|.| +0#0000000&@54
|#+0#0000e05&| |E|a|c|h| |l|i|n|e| |i|s| |a| |f|i|l|e| |p|a|t@1|e|r|n| |f|o|l@1|o|w|e|d| |b|y| |o|n|e| |o|r| |m|o|r|e| |o|w|n|e|r|s|.| +0#0000000&@13
@75
|*| @6|@+0#00e0e07&|g|l|o|b|a|l|-|o|w|n|e|r|1| +0#0000000&|@+0#00e0e07&|g|l|o|b|a|l|-|o|w|n|e|r|2| +0#0000000&@37
|*|.|j|s| @3|@+0#00e0e07&|j|s|-|o|w|n|e|r| +0#0000000&|#+0#0000e05&|T|h|i|s| |i|s| |a|n| |i|n|l|i|n|e| |c|o|m@1|e|n|t|.| +0#0000000&@29
|*|.|g|o| @3|d+0#00e0e07&|o|c|s|@|e|x|a|m|p|l|e|.|c|o|m| +0#0000000&@50
|*|.|t|x|t| @2|@+0#00e0e07&|o|c|t|o|-|o|r|g|/|o|c|t|o|c|a|t|s| +0#0000000&@48
|/|a|/|b|/| @2|@+0#00e0e07&|d|o|c|t|o|c|a|t| +0#0000000&@57
|d|o|c|s|/|*| @1|d+0#00e0e07&|o|c|s|@|e|x|a|m|p|l|e|.|c|o|m| +0#0000000&|@+0#00e0e07&|o|t|h|e|r| +0#0000000&@43
|*@1|/|l|o|g|s| |@+0#00e0e07&|o|c|t|o|c|a|t| +0#0000000&@58
@75
|#+0#0000e05&| |v|i|m|:| |s|e|t| |f|t|=|c|o|d|e|o|w|n|e|r|s|:| +0#0000000&@49
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
| +0#0000000&@56|1|,|1| @10|A|l@1|

View File

@ -0,0 +1,12 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.
* @global-owner1 @global-owner2
*.js @js-owner #This is an inline comment.
*.go docs@example.com
*.txt @octo-org/octocats
/a/b/ @doctocat
docs/* docs@example.com @other
**/logs @octocat
# vim: set ft=codeowners:

View File

@ -189,6 +189,7 @@ def s:GetFilenameChecks(): dict<list<string>>
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'],

View File

@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1764,
/**/
1763,
/**/