Skip to content

Commit ed7d8e5

Browse files
dseomnchrisbra
authored andcommitted
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 <david@mandelberg.org> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent f1c3134 commit ed7d8e5

7 files changed

Lines changed: 73 additions & 1 deletion

File tree

.github/MAINTAINERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ runtime/ftplugin/liquid.vim @tpope
225225
runtime/ftplugin/lua.vim @dkearns
226226
runtime/ftplugin/lc.vim @ribru17
227227
runtime/ftplugin/lynx.vim @dkearns
228+
runtime/ftplugin/m17ndb.vim @dseomn
228229
runtime/ftplugin/m3build.vim @dkearns
229230
runtime/ftplugin/m3quake.vim @dkearns
230231
runtime/ftplugin/markdown.vim @tpope
@@ -367,6 +368,7 @@ runtime/indent/ld.vim @dkearns
367368
runtime/indent/less.vim @genoma
368369
runtime/indent/liquid.vim @tpope
369370
runtime/indent/lua.vim @marcuscf
371+
runtime/indent/m17ndb.vim @dseomn
370372
runtime/indent/make.vim @dkearns
371373
runtime/indent/meson.vim @Liambeguin
372374
runtime/indent/mma.vim @dkearns
@@ -533,6 +535,7 @@ runtime/syntax/liquid.vim @tpope
533535
runtime/syntax/lua.vim @marcuscf
534536
runtime/syntax/lyrics.vim @ObserverOfTime
535537
runtime/syntax/lynx.vim @dkearns
538+
runtime/syntax/m17ndb.vim @dseomn
536539
runtime/syntax/m3build.vim @dkearns
537540
runtime/syntax/m3quake.vim @dkearns
538541
runtime/syntax/mailcap.vim @dkearns

runtime/filetype.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim support file to detect file types
22
"
33
" Maintainer: The Vim Project <https://github.com/vim/vim>
4-
" Last Change: 2025 Feb 22
4+
" Last Change: 2025 Feb 23
55
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
66

77
" Listen very carefully, I will say this only once
@@ -341,6 +341,11 @@ au BufNewFile,BufRead *.capnp setf capnp
341341
" Cgdb config file
342342
au BufNewFile,BufRead cgdbrc setf cgdbrc
343343

344+
" m17n database files. */m17n/* matches installed files, */.m17n.d/* matches
345+
" per-user config files, */m17n-db/* matches the git repo. (must be before
346+
" *.cs)
347+
au BufNewFile,BufRead */{m17n,.m17n.d,m17n-db}/*.{ali,cs,dir,flt,fst,lnm,mic,mim,tbl} setf m17ndb
348+
344349
" C#
345350
au BufNewFile,BufRead *.cs,*.csx,*.cake setf cs
346351

runtime/ftplugin/m17ndb.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
" Vim filetype plugin
2+
" Language: m17n database
3+
" Maintainer: David Mandelberg <david@mandelberg.org>
4+
" Last Change: 2025 Feb 21
5+
6+
if exists('b:did_ftplugin')
7+
finish
8+
endif
9+
let b:did_ftplugin = 1
10+
11+
setlocal comments=:;;;,:;;,:;
12+
setlocal commentstring=;\ %s
13+
setlocal iskeyword=!-~,@,^34,^(,^),^92
14+
setlocal lisp
15+
setlocal lispwords=
16+
17+
let b:undo_ftplugin = "setlocal comments< commentstring< iskeyword< lisp< lispwords<"

runtime/indent/m17ndb.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
" Vim indent file
2+
" Language: m17n database
3+
" Maintainer: David Mandelberg <david@mandelberg.org>
4+
" Last Change: 2025 Feb 21
5+
6+
if exists("b:did_indent")
7+
finish
8+
endif
9+
let b:did_indent = 1
10+
11+
setlocal autoindent
12+
setlocal nosmartindent
13+
14+
let b:undo_indent = "setlocal autoindent< smartindent<"

runtime/syntax/m17ndb.vim

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
" Vim syntax file
2+
" Language: m17n database
3+
" Maintainer: David Mandelberg <david@mandelberg.org>
4+
" Last Change: 2025 Feb 21
5+
"
6+
" https://www.nongnu.org/m17n/manual-en/m17nDBFormat.html describes the
7+
" syntax, but some of its regexes don't match the code. read_element() in
8+
" https://git.savannah.nongnu.org/cgit/m17n/m17n-lib.git/tree/src/plist.c
9+
" seems to be a better place to understand the syntax.
10+
11+
if exists("b:current_syntax")
12+
finish
13+
endif
14+
let b:current_syntax = "m17ndb"
15+
16+
syn match m17ndbSymbol /\([^\x00- ()"\\]\|\\\_.\)\+/
17+
syn match m17ndbComment ";.*$" contains=@Spell
18+
syn match m17ndbInteger "-\?[0-9]\+"
19+
syn match m17ndbInteger "[0#]x[0-9A-Fa-f]\+"
20+
syn match m17ndbCharacter "?\(\_[^\\]\|\\\_.\)"
21+
syn region m17ndbText start=/\Z"/ skip=/\\\\\|\\"/ end=/"/
22+
syn region m17ndbPlist matchgroup=m17ndbParen start="(" end=")" fold contains=ALL
23+
24+
hi def link m17ndbCharacter Character
25+
hi def link m17ndbComment Comment
26+
hi def link m17ndbInteger Number
27+
hi def link m17ndbParen Delimiter
28+
hi def link m17ndbText String

src/testdir/test_filetype.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ def s:GetFilenameChecks(): dict<list<string>>
449449
luau: ['file.luau'],
450450
lynx: ['lynx.cfg'],
451451
lyrics: ['file.lrc'],
452+
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',
453+
'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',
454+
'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'],
452455
m3build: ['m3makefile', 'm3overrides'],
453456
m3quake: ['file.quake', 'cm3.cfg'],
454457
m4: ['file.at', '.m4_history'],

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1140,
707709
/**/
708710
1139,
709711
/**/

0 commit comments

Comments
 (0)