diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS index 43b7fb4a69..a8099c4ec3 100644 --- a/.github/MAINTAINERS +++ b/.github/MAINTAINERS @@ -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 diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5d27801f23..934e4042f6 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -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 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/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/runtime/syntax/testdir/dumps/codeowners_00.dump b/runtime/syntax/testdir/dumps/codeowners_00.dump new file mode 100644 index 0000000000..41d7d3781a --- /dev/null +++ b/runtime/syntax/testdir/dumps/codeowners_00.dump @@ -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| diff --git a/runtime/syntax/testdir/input/codeowners.txt b/runtime/syntax/testdir/input/codeowners.txt new file mode 100644 index 0000000000..e72a77035f --- /dev/null +++ b/runtime/syntax/testdir/input/codeowners.txt @@ -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: diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 5752e7c403..7aa3197875 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -189,6 +189,7 @@ def s:GetFilenameChecks(): dict> 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'], diff --git a/src/version.c b/src/version.c index 696fde76f4..1e231bf31f 100644 --- a/src/version.c +++ b/src/version.c @@ -724,6 +724,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1764, /**/ 1763, /**/