summaryrefslogtreecommitdiffstats
path: root/runtime/autoload
diff options
context:
space:
mode:
authorPowerUser64 <blake@blakenorth.net>2024-06-19 20:32:11 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-19 20:32:11 +0200
commitaa61b8a9087e9cd999ef07e0d87b60f43d68f2c6 (patch)
tree9e6fb3b44b2490c788526680c9fed19fe3df6ce3 /runtime/autoload
parentca7f93e6f351b310c17cfc8f88acf21c839d6116 (diff)
patch 9.1.0505: filetype: Faust files are not recognizedv9.1.0505
Problem: filetype: Faust files are not recognized Solution: Detect '*.lib' files as Faust filetype, add detection for '*.dsp' files (Faust or Make), remove '*.lib' from Cobol filetype (PowerUser64) closes: #14894 Signed-off-by: PowerUser64 <blake@blakenorth.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/dist/ft.vim50
1 files changed, 50 insertions, 0 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 50b4c3ef21..2e93dd0d57 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -1265,6 +1265,56 @@ export def FTtyp()
setf typst
enddef
+# Detect Microsoft Developer Studio Project files (Makefile) or Faust DSP
+# files.
+export def FTdsp()
+ if exists("g:filetype_dsp")
+ exe "setf " .. g:filetype_dsp
+ return
+ endif
+
+ # Test the filename
+ if expand('%:t') =~ '^[mM]akefile.*$'
+ setf make
+ return
+ endif
+
+ # Test the file contents
+ for line in getline(1, 200)
+ # Chech for comment style
+ if line =~ '^#.*'
+ setf make
+ return
+ endif
+
+ # Check for common lines
+ if line =~ '^.*Microsoft Developer Studio Project File.*$'
+ setf make
+ return
+ endif
+
+ if line =~ '^!MESSAGE This is not a valid makefile\..+$'
+ setf make
+ return
+ endif
+
+ # Check for keywords
+ if line =~ '^!(IF,ELSEIF,ENDIF).*$'
+ setf make
+ return
+ endif
+
+ # Check for common assignments
+ if line =~ '^SOURCE=.*$'
+ setf make
+ return
+ endif
+ endfor
+
+ # Otherwise, assume we have a Faust file
+ setf faust
+enddef
+
# Set the filetype of a *.v file to Verilog, V or Cog based on the first 200
# lines.
export def FTv()