comparison runtime/autoload/dist/ft.vim @ 30023:87063bfe81cd v9.0.0349

patch 9.0.0349: filetype of *.sil files not well detected Commit: https://github.com/vim/vim/commit/be807d582499acbe314ead3891481cba6ca136df Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 1 15:01:25 2022 +0100 patch 9.0.0349: filetype of *.sil files not well detected Problem: Filetype of *.sil files not well detected. Solution: Inspect the file contents to guess the filetype.
author Bram Moolenaar <Bram@vim.org>
date Thu, 01 Sep 2022 16:15:03 +0200
parents 2198955f9e27
children d4c8fdaa3ae7
comparison
equal deleted inserted replaced
30022:b8bc697bb6a1 30023:87063bfe81cd
874 if line =~ lprolog_comment || line =~# lprolog_keyword 874 if line =~ lprolog_comment || line =~# lprolog_keyword
875 setf lprolog 875 setf lprolog
876 elseif line =~ sml_comment || line =~# sml_keyword 876 elseif line =~ sml_comment || line =~# sml_keyword
877 setf sml 877 setf sml
878 endif 878 endif
879 enddef
880
881 # This function checks the first 100 lines of files matching "*.sil" to
882 # resolve detection between Swift Intermediate Language and SILE.
883 export def FTsil()
884 for lnum in range(1, [line('$'), 100]->min())
885 var line: string = getline(lnum)
886 if line =~ '^\s*[\\%]'
887 setf sile
888 return
889 elseif line =~ '^\s*\S'
890 setf sil
891 return
892 endif
893 endfor
894 # no clue, default to "sil"
895 setf sil
879 enddef 896 enddef
880 897
881 export def FTsys() 898 export def FTsys()
882 if exists("g:filetype_sys") 899 if exists("g:filetype_sys")
883 exe "setf " .. g:filetype_sys 900 exe "setf " .. g:filetype_sys