2023-06-19 09:54:39 +00:00
|
|
|
-- Override detection from lua/vim/filetype/detect.lua
|
|
|
|
-- removes match on |%w+| for SuperCollider
|
|
|
|
vim.filetype.add({
|
|
|
|
extension = {
|
|
|
|
-- This function checks the first 25 lines of file extension "sc" to resolve
|
|
|
|
-- detection between scala and SuperCollider
|
|
|
|
sc = function(path, bufnr)
|
|
|
|
for _, line in ipairs(vim.filetype.getlines(bufnr, 1, 25)) do
|
|
|
|
if
|
2024-03-15 14:15:26 +00:00
|
|
|
vim.filetype.findany(line, {
|
|
|
|
'var%s<',
|
|
|
|
'classvar%s<',
|
|
|
|
'%^this.*',
|
|
|
|
'%+%s%w*%s{',
|
|
|
|
'%*ar%s',
|
|
|
|
})
|
2023-06-19 09:54:39 +00:00
|
|
|
then
|
|
|
|
return 'supercollider'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 'scala'
|
|
|
|
end
|
|
|
|
}
|
|
|
|
})
|