aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/filetype.lua4
-rw-r--r--runtime/lua/vim/filetype/detect.lua35
2 files changed, 37 insertions, 2 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 2bb50d8c0b..7373c403b5 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -281,7 +281,6 @@ local extension = {
cook = 'cook',
cmake = 'cmake',
cmod = 'cmod',
- lib = 'cobol',
cob = 'cobol',
cbl = 'cobol',
atg = 'coco',
@@ -366,6 +365,7 @@ local extension = {
gv = 'dot',
drac = 'dracula',
drc = 'dracula',
+ dsp = detect.dsp,
dtd = 'dtd',
d = detect.dtrace,
dts = 'dts',
@@ -417,6 +417,7 @@ local extension = {
fal = 'falcon',
fan = 'fan',
fwt = 'fan',
+ lib = 'faust',
fnl = 'fennel',
m4gl = 'fgl',
['4gl'] = 'fgl',
@@ -666,7 +667,6 @@ local extension = {
eml = 'mail',
mk = 'make',
mak = 'make',
- dsp = 'make',
page = 'mallard',
map = 'map',
mws = 'maple',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 997b53ba4b..b52dba7388 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -472,6 +472,41 @@ function M.def(_, bufnr)
end
--- @type vim.filetype.mapfn
+function M.dsp(path, bufnr)
+ if vim.g.filetype_dsp then
+ return vim.g.filetype_dsp
+ end
+
+ -- Test the filename
+ local file_name = fn.fnamemodify(path, ':t')
+ if file_name:find('^[mM]akefile.*$') then
+ return 'make'
+ end
+
+ -- Test the file contents
+ for _, line in ipairs(getlines(bufnr, 1, 200)) do
+ if
+ findany(line, {
+ -- Check for comment style
+ [[#.*]],
+ -- Check for common lines
+ [[^.*Microsoft Developer Studio Project File.*$]],
+ [[^!MESSAGE This is not a valid makefile\..+$]],
+ -- Check for keywords
+ [[^!(IF,ELSEIF,ENDIF).*$]],
+ -- Check for common assignments
+ [[^SOURCE=.*$]],
+ })
+ then
+ return 'make'
+ end
+ end
+
+ -- Otherwise, assume we have a Faust file
+ return 'faust'
+end
+
+--- @type vim.filetype.mapfn
function M.e(_, bufnr)
if vim.g.filetype_euphoria then
return vim.g.filetype_euphoria