mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
vim-patch:9.0.0349: filetype of *.sil files not well detected (#20050)
Problem: Filetype of *.sil files not well detected.
Solution: Inspect the file contents to guess the filetype.
be807d5824
This commit is contained in:
committed by
GitHub
parent
12fe197cff
commit
ce80b8f50d
19
runtime/autoload/dist/ft.vim
vendored
19
runtime/autoload/dist/ft.vim
vendored
@@ -468,7 +468,7 @@ endfunc
|
||||
|
||||
" Returns true if file content looks like LambdaProlog module
|
||||
func IsLProlog()
|
||||
" skip apparent comments and blank lines, what looks like
|
||||
" skip apparent comments and blank lines, what looks like
|
||||
" LambdaProlog comment may be RAPID header
|
||||
let l = nextnonblank(1)
|
||||
while l > 0 && l < line('$') && getline(l) =~ '^\s*%' " LambdaProlog comment
|
||||
@@ -877,6 +877,23 @@ func dist#ft#FTsig()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" This function checks the first 100 lines of files matching "*.sil" to
|
||||
" resolve detection between Swift Intermediate Language and SILE.
|
||||
func dist#ft#FTsil()
|
||||
for lnum in range(1, [line('$'), 100]->min())
|
||||
let line = getline(lnum)
|
||||
if line =~ '^\s*[\\%]'
|
||||
setf sile
|
||||
return
|
||||
elseif line =~ '^\s*\S'
|
||||
setf sil
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
" no clue, default to "sil"
|
||||
setf sil
|
||||
endfunc
|
||||
|
||||
func dist#ft#FTsys()
|
||||
if exists("g:filetype_sys")
|
||||
exe "setf " .. g:filetype_sys
|
||||
|
||||
Reference in New Issue
Block a user