mirror of
https://github.com/neovim/neovim.git
synced 2026-05-23 21:30:11 +00:00
vim-patch:9.2.0489: filetype: some Objective-C files are not recognized
Problem: filetype: some Objective-C files are not recognized
Solution: Add g:filetype_mm override variable, improve the objective c
pattern detection (Keith Smiley).
closes: vim/vim#20221
bc7f736a39
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
This commit is contained in:
@@ -1258,8 +1258,12 @@ end
|
||||
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.mm(_, bufnr)
|
||||
if vim.g.filetype_mm then
|
||||
return vim.g.filetype_mm
|
||||
end
|
||||
|
||||
for _, line in ipairs(getlines(bufnr, 1, 20)) do
|
||||
if matchregex(line, [[\c^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)]]) then
|
||||
if matchregex(line, [[\c^\s*\(//\|#\s*\(include\|import\)\>\|@import\>\|/\*\)]]) then
|
||||
return 'objcpp'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user