# Vim functions for file type detection
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2026 Apr 23
+# Last Change: 2026 May 16
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
# These functions are moved here from runtime/filetype.vim to make startup
enddef
export def FTmm()
+ if exists("g:filetype_mm")
+ exe "setf " .. g:filetype_mm
+ return
+ endif
+
var n = 1
while n < 20
- if getline(n) =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)'
+ if getline(n) =~ '^\s*\(//\|#\s*\(include\|import\)\>\|@import\>\|/\*\)'
setf objcpp
return
endif
-*filetype.txt* For Vim version 9.2. Last change: 2026 Apr 13
+*filetype.txt* For Vim version 9.2. Last change: 2026 May 16
VIM REFERENCE MANUAL by Bram Moolenaar
*.int g:filetype_int
*.lsl g:filetype_lsl
*.m g:filetype_m |ft-mathematica-syntax|
+ *.mm g:filetype_mm
*.mac g:filetype_mac
*[mM]makefile,*.mk,*.mak,[mM]akefile*
g:make_flavor |ft-make-syntax|
endtry
endfunc
+func Test_mm_file()
+ filetype on
+
+ call writefile(['#import "test.h"'], 'Xfile.mm', 'D')
+ split Xfile.mm
+ call assert_equal('objcpp', &filetype)
+ bwipe!
+
+ call writefile(['// Objective-C++ line comment'], 'Xfile.mm', 'D')
+ split Xfile.mm
+ call assert_equal('objcpp', &filetype)
+ bwipe!
+
+ call writefile(['.TH VIM 1 "YYYY Mth DD"'], 'Xfile.mm', 'D')
+ split Xfile.mm
+ call assert_equal('nroff', &filetype)
+ bwipe!
+
+ try
+ let g:filetype_mm = 'objcpp'
+ call writefile(['.TH VIM 1 "YYYY Mth DD"'], 'Xfile_override.mm', 'D')
+ split Xfile_override.mm
+ call assert_equal('objcpp', &filetype)
+ bwipe!
+ finally
+ unlet! g:filetype_mm
+ endtry
+
+ filetype off
+endfunc
+
func Test_mod_file()
filetype on
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 489,
/**/
488,
/**/