mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.1.0505: filetype: Faust files are not recognized
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>
This commit is contained in:
committed by
Christian Brabandt
parent
ca7f93e6f3
commit
aa61b8a908
50
runtime/autoload/dist/ft.vim
vendored
50
runtime/autoload/dist/ft.vim
vendored
@@ -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()
|
||||
|
@@ -149,6 +149,7 @@ variables can be used to overrule the filetype used for certain extensions:
|
||||
*.csh g:filetype_csh |ft-csh-syntax|
|
||||
*.dat g:filetype_dat
|
||||
*.def g:filetype_def
|
||||
*.dsp g:filetype_dsp
|
||||
*.f g:filetype_f |ft-forth-syntax|
|
||||
*.frm g:filetype_frm |ft-form-syntax|
|
||||
*.fs g:filetype_fs |ft-forth-syntax|
|
||||
|
@@ -457,7 +457,7 @@ au BufNewFile,BufRead */.cmus/{autosave,rc,command-history,*.theme} setf cmusrc
|
||||
au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc
|
||||
|
||||
" Cobol
|
||||
au BufNewFile,BufRead *.cbl,*.cob,*.lib setf cobol
|
||||
au BufNewFile,BufRead *.cbl,*.cob setf cobol
|
||||
" cobol or zope form controller python script? (heuristic)
|
||||
au BufNewFile,BufRead *.cpy
|
||||
\ if getline(1) =~ '^##' |
|
||||
@@ -532,6 +532,10 @@ au BufNewFile,BufRead s6-* setf execline
|
||||
" Fontconfig config files
|
||||
au BufNewFile,BufRead fonts.conf setf xml
|
||||
|
||||
" Faust
|
||||
au BufNewFile,BufRead *.lib setf faust
|
||||
au BufNewFile,BufRead *.dsp call dist#ft#FTdsp()
|
||||
|
||||
" Libreoffice config files
|
||||
au BufNewFile,BufRead *.xcu,*.xlb,*.xlc,*.xba setf xml
|
||||
au BufNewFile,BufRead psprint.conf,sofficerc setf dosini
|
||||
@@ -1365,8 +1369,8 @@ au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases
|
||||
au BufNewFile,BufRead .mailcap,mailcap setf mailcap
|
||||
|
||||
" Makefile
|
||||
au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make
|
||||
au BufNewFile,BufRead Kbuild setf make
|
||||
au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak setf make
|
||||
au BufNewFile,BufRead Kbuild setf make
|
||||
|
||||
" MakeIndex
|
||||
au BufNewFile,BufRead *.ist,*.mst setf ist
|
||||
|
Reference in New Issue
Block a user