patch 9.1.1140: filetype: m17ndb files are not detected Commit: https://github.com/vim/vim/commit/ed7d8e55ac232758fc14fd132994b4a09b19350b Author: David Mandelberg <da...@mandelberg.org> Date: Sun Feb 23 09:41:42 2025 +0100
patch 9.1.1140: filetype: m17ndb files are not detected Problem: filetype: m17ndb files are not detected Solution: detect m17ndb files as m17ndb filetype, include filetype, syntax and indent files for the new filetype (David Mandelberg). References: https://www.nongnu.org/m17n/manual-en/m17nDBFormat.html describes the format. https://git.savannah.nongnu.org/cgit/m17n/m17n-db.git/tree/ has examples of the files. closes: #16696 Signed-off-by: David Mandelberg <da...@mandelberg.org> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS index 7a080f936..c316849cf 100644 --- a/.github/MAINTAINERS +++ b/.github/MAINTAINERS @@ -225,6 +225,7 @@ runtime/ftplugin/liquid.vim @tpope runtime/ftplugin/lua.vim @dkearns runtime/ftplugin/lc.vim @ribru17 runtime/ftplugin/lynx.vim @dkearns +runtime/ftplugin/m17ndb.vim @dseomn runtime/ftplugin/m3build.vim @dkearns runtime/ftplugin/m3quake.vim @dkearns runtime/ftplugin/markdown.vim @tpope @@ -367,6 +368,7 @@ runtime/indent/ld.vim @dkearns runtime/indent/less.vim @genoma runtime/indent/liquid.vim @tpope runtime/indent/lua.vim @marcuscf +runtime/indent/m17ndb.vim @dseomn runtime/indent/make.vim @dkearns runtime/indent/meson.vim @Liambeguin runtime/indent/mma.vim @dkearns @@ -533,6 +535,7 @@ runtime/syntax/liquid.vim @tpope runtime/syntax/lua.vim @marcuscf runtime/syntax/lyrics.vim @ObserverOfTime runtime/syntax/lynx.vim @dkearns +runtime/syntax/m17ndb.vim @dseomn runtime/syntax/m3build.vim @dkearns runtime/syntax/m3quake.vim @dkearns runtime/syntax/mailcap.vim @dkearns diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 0e669047e..ff6905f91 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: The Vim Project <https://github.com/vim/vim> -" Last Change: 2025 Feb 22 +" Last Change: 2025 Feb 23 " Former Maintainer: Bram Moolenaar <b...@vim.org> " Listen very carefully, I will say this only once @@ -341,6 +341,11 @@ au BufNewFile,BufRead *.capnp setf capnp " Cgdb config file au BufNewFile,BufRead cgdbrc setf cgdbrc +" m17n database files. */m17n/* matches installed files, */.m17n.d/* matches +" per-user config files, */m17n-db/* matches the git repo. (must be before +" *.cs) +au BufNewFile,BufRead */{m17n,.m17n.d,m17n-db}/*.{ali,cs,dir,flt,fst,lnm,mic,mim,tbl} setf m17ndb + " C# au BufNewFile,BufRead *.cs,*.csx,*.cake setf cs diff --git a/runtime/ftplugin/m17ndb.vim b/runtime/ftplugin/m17ndb.vim new file mode 100644 index 000000000..e4457cef9 --- /dev/null +++ b/runtime/ftplugin/m17ndb.vim @@ -0,0 +1,17 @@ +" Vim filetype plugin +" Language: m17n database +" Maintainer: David Mandelberg <da...@mandelberg.org> +" Last Change: 2025 Feb 21 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setlocal comments=:;;;,:;;,:; +setlocal commentstring=;\ %s +setlocal iskeyword=!-~,@,^34,^(,^),^92 +setlocal lisp +setlocal lispwords= + +let b:undo_ftplugin = "setlocal comments< commentstring< iskeyword< lisp< lispwords<" diff --git a/runtime/indent/m17ndb.vim b/runtime/indent/m17ndb.vim new file mode 100644 index 000000000..d25aafe13 --- /dev/null +++ b/runtime/indent/m17ndb.vim @@ -0,0 +1,14 @@ +" Vim indent file +" Language: m17n database +" Maintainer: David Mandelberg <da...@mandelberg.org> +" Last Change: 2025 Feb 21 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal autoindent +setlocal nosmartindent + +let b:undo_indent = "setlocal autoindent< smartindent<" diff --git a/runtime/syntax/m17ndb.vim b/runtime/syntax/m17ndb.vim new file mode 100644 index 000000000..8d63e6f91 --- /dev/null +++ b/runtime/syntax/m17ndb.vim @@ -0,0 +1,28 @@ +" Vim syntax file +" Language: m17n database +" Maintainer: David Mandelberg <da...@mandelberg.org> +" Last Change: 2025 Feb 21 +" +" https://www.nongnu.org/m17n/manual-en/m17nDBFormat.html describes the +" syntax, but some of its regexes don't match the code. read_element() in +" https://git.savannah.nongnu.org/cgit/m17n/m17n-lib.git/tree/src/plist.c +" seems to be a better place to understand the syntax. + +if exists("b:current_syntax") + finish +endif +let b:current_syntax = "m17ndb" + +syn match m17ndbSymbol /\([^\x00- ()"\]\|\\_.\)\+/ +syn match m17ndbComment ";.*$" contains=@Spell +syn match m17ndbInteger "-\?[0-9]\+" +syn match m17ndbInteger "[0#]x[0-9A-Fa-f]\+" +syn match m17ndbCharacter "?\(\_[^\]\|\\_.\)" +syn region m17ndbText start=/\Z"/ skip=/\\\|\"/ end=/"/ +syn region m17ndbPlist matchgroup=m17ndbParen start="(" end=")" fold contains=ALL + +hi def link m17ndbCharacter Character +hi def link m17ndbComment Comment +hi def link m17ndbInteger Number +hi def link m17ndbParen Delimiter +hi def link m17ndbText String diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 3196856c0..bbc2d1f00 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -449,6 +449,9 @@ def s:GetFilenameChecks(): dict<list<string>> luau: ['file.luau'], lynx: ['lynx.cfg'], lyrics: ['file.lrc'], + m17ndb: ['any/m17n/file.ali', 'any/m17n/file.cs', 'any/m17n/file.dir', 'any/m17n/file.flt', 'any/m17n/file.fst', 'any/m17n/file.lnm', 'any/m17n/file.mic', 'any/m17n/file.mim', 'any/m17n/file.tbl', + 'any/.m17n.d/file.ali', 'any/.m17n.d/file.cs', 'any/.m17n.d/file.dir', 'any/.m17n.d/file.flt', 'any/.m17n.d/file.fst', 'any/.m17n.d/file.lnm', 'any/.m17n.d/file.mic', 'any/.m17n.d/file.mim', 'any/.m17n.d/file.tbl', + 'any/m17n-db/file.ali', 'any/m17n-db/file.cs', 'any/m17n-db/file.dir', 'any/m17n-db/FLT/file.flt', 'any/m17n-db/file.fst', 'any/m17n-db/LANGDATA/file.lnm', 'any/m17n-db/file.mic', 'any/m17n-db/MIM/file.mim', 'any/m17n-db/file.tbl'], m3build: ['m3makefile', 'm3overrides'], m3quake: ['file.quake', 'cm3.cfg'], m4: ['file.at', '.m4_history'], diff --git a/src/version.c b/src/version.c index fe6ebd28d..bd7b1f68d 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1140, /**/ 1139, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1tm7bn-007zKw-UT%40256bit.org.