mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
vim-patch:9.0.0349: filetype of *.sil files not well detected (#20050)
Problem: Filetype of *.sil files not well detected.
Solution: Inspect the file contents to guess the filetype.
be807d5824
This commit is contained in:
committed by
GitHub
parent
12fe197cff
commit
ce80b8f50d
@@ -902,7 +902,9 @@ local extension = {
|
||||
sig = function(path, bufnr)
|
||||
return require('vim.filetype.detect').sig(bufnr)
|
||||
end,
|
||||
sil = 'sil',
|
||||
sil = function(path, bufnr)
|
||||
return require('vim.filetype.detect').sil(bufnr)
|
||||
end,
|
||||
sim = 'simula',
|
||||
['s85'] = 'sinda',
|
||||
sin = 'sinda',
|
||||
|
||||
@@ -1194,6 +1194,19 @@ function M.shell(path, contents, name)
|
||||
return name
|
||||
end
|
||||
|
||||
-- Swift Intermediate Language or SILE
|
||||
function M.sil(bufnr)
|
||||
for _, line in ipairs(getlines(bufnr, 1, 100)) do
|
||||
if line:find('^%s*[\\%%]') then
|
||||
return 'sile'
|
||||
elseif line:find('^%s*%S') then
|
||||
return 'sil'
|
||||
end
|
||||
end
|
||||
-- No clue, default to "sil"
|
||||
return 'sil'
|
||||
end
|
||||
|
||||
-- SMIL or SNMP MIB file
|
||||
function M.smi(bufnr)
|
||||
local line = getlines(bufnr, 1)
|
||||
|
||||
Reference in New Issue
Block a user