comparison runtime/autoload/dist/ft.vim @ 28443:5896c0f6cdd7 v8.2.4746

patch 8.2.4746: supercollider filetype not recognized Commit: https://github.com/vim/vim/commit/8cac20ed42b7b7fc9c6b54e3055ca1047f50b8ca Author: ranjithshegde <ranjithshegde@gmail.com> Date: Wed Apr 13 15:29:21 2022 +0100 patch 8.2.4746: supercollider filetype not recognized Problem: Supercollider filetype not recognized. Solution: Match file extentions and check file contents to detect supercollider. (closes #10142)
author Bram Moolenaar <Bram@vim.org>
date Wed, 13 Apr 2022 16:30:05 +0200
parents cc4d3ded4004
children 7f0ec490d608
comparison
equal deleted inserted replaced
28442:b045e372ab4c 28443:5896c0f6cdd7
764 export def SQL() 764 export def SQL()
765 if exists("g:filetype_sql") 765 if exists("g:filetype_sql")
766 exe "setf " .. g:filetype_sql 766 exe "setf " .. g:filetype_sql
767 else 767 else
768 setf sql 768 setf sql
769 endif
770 enddef
771
772 # This function checks the first 25 lines of file extension "sc" to resolve
773 # detection between scala and SuperCollider
774 export def FTsc()
775 for lnum in range(1, min([line("$"), 25]))
776 if getline(lnum) =~# '[A-Za-z0-9]*\s:\s[A-Za-z0-9]\|var\s<\|classvar\s<\|\^this.*\||\w*|\|+\s\w*\s{\|\*ar\s'
777 setf supercollider
778 return
779 endif
780 endfor
781 setf scala
782 enddef
783
784 # This function checks the first line of file extension "scd" to resolve
785 # detection between scdoc and SuperCollider
786 export def FTscd()
787 if getline(1) =~# '\%^\S\+(\d[0-9A-Za-z]*)\%(\s\+\"[^"]*\"\%(\s\+\"[^"]*\"\)\=\)\=$'
788 setf scdoc
789 else
790 setf supercollider
769 endif 791 endif
770 enddef 792 enddef
771 793
772 # If the file has an extension of 't' and is in a directory 't' or 'xt' then 794 # If the file has an extension of 't' and is in a directory 't' or 'xt' then
773 # it is almost certainly a Perl test file. 795 # it is almost certainly a Perl test file.