Change filetype detection for .sc
The code used deprecated functions and I don't use Supercollider anyway, so make .sc always be a scala file
This commit is contained in:
parent
0223565b9a
commit
c6010628ca
|
@ -1,18 +1,19 @@
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
extension = {
|
extension = {
|
||||||
['vtt'] = 'vtt',
|
["vtt"] = "vtt",
|
||||||
['typ'] = 'typst',
|
["typ"] = "typst",
|
||||||
|
["sc"] = "scala",
|
||||||
},
|
},
|
||||||
filename = {
|
filename = {
|
||||||
['.scalafmt.conf'] = 'hocon',
|
[".scalafmt.conf"] = "hocon",
|
||||||
['kitty.conf'] = 'kitty',
|
["kitty.conf"] = "kitty",
|
||||||
['neomuttrc'] = 'neomutt',
|
["neomuttrc"] = "neomutt",
|
||||||
['template'] = 'sh',
|
["template"] = "sh",
|
||||||
['mbsyncrc'] = 'mbsyncrc',
|
["mbsyncrc"] = "mbsyncrc",
|
||||||
},
|
},
|
||||||
pattern = {
|
pattern = {
|
||||||
['${XDG_CONFIG_HOME}/kitty/*.conf'] = 'kitty',
|
["${XDG_CONFIG_HOME}/kitty/*.conf"] = "kitty",
|
||||||
['${XDG_CONFIG_HOME}/kitty/*.session'] = 'kitty-session',
|
["${XDG_CONFIG_HOME}/kitty/*.session"] = "kitty-session",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
-- 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
|
|
||||||
vim.filetype.findany(line, {
|
|
||||||
'var%s<',
|
|
||||||
'classvar%s<',
|
|
||||||
'%^this.*',
|
|
||||||
'%+%s%w*%s{',
|
|
||||||
'%*ar%s',
|
|
||||||
})
|
|
||||||
then
|
|
||||||
return 'supercollider'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return 'scala'
|
|
||||||
end
|
|
||||||
}
|
|
||||||
})
|
|
Loading…
Reference in a new issue