diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-01 15:01:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-01 15:01:25 +0100 |
commit | be807d582499acbe314ead3891481cba6ca136df (patch) | |
tree | 89e6a4e6e613d54c63653570c69a7c5a935f7674 /runtime/autoload/dist/ft.vim | |
parent | 36eb14fa3e729434cbb6f9078b4b330ae4f864f9 (diff) |
patch 9.0.0349: filetype of *.sil files not well detectedv9.0.0349
Problem: Filetype of *.sil files not well detected.
Solution: Inspect the file contents to guess the filetype.
Diffstat (limited to 'runtime/autoload/dist/ft.vim')
-rw-r--r-- | runtime/autoload/dist/ft.vim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 5db68d3cb4..48eaf3f60f 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -878,6 +878,23 @@ export def FTsig() endif enddef +# This function checks the first 100 lines of files matching "*.sil" to +# resolve detection between Swift Intermediate Language and SILE. +export def FTsil() + for lnum in range(1, [line('$'), 100]->min()) + var line: string = getline(lnum) + if line =~ '^\s*[\\%]' + setf sile + return + elseif line =~ '^\s*\S' + setf sil + return + endif + endfor + # no clue, default to "sil" + setf sil +enddef + export def FTsys() if exists("g:filetype_sys") exe "setf " .. g:filetype_sys |