diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-06-30 16:25:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-30 16:25:21 +0100 |
commit | cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8 (patch) | |
tree | af16e32444f170534f389fdefcac4f90409277f9 /runtime/autoload/dist/ft.vim | |
parent | d25f003342aca9889067f2e839963dfeccf1fe05 (diff) |
patch 9.0.0012: signature files not detected properlyv9.0.0012
Problem: Signature files not detected properly.
Solution: Add a function to better detect signature files. (Doug Kearns)
Diffstat (limited to 'runtime/autoload/dist/ft.vim')
-rw-r--r-- | runtime/autoload/dist/ft.vim | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 5f48f4b10d..a96bdf5e72 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -459,7 +459,7 @@ export def FTmm() setf nroff enddef -# Returns true if file content looks like LambdaProlog +# Returns true if file content looks like LambdaProlog module def IsLProlog(): bool # skip apparent comments and blank lines, what looks like # LambdaProlog comment may be RAPID header @@ -848,6 +848,27 @@ export def FTperl(): number return 0 enddef +# LambdaProlog and Standard ML signature files +export def FTsig() + if exists("g:filetype_sig") + exe "setf " .. g:filetype_sig + return + endif + + var lprolog_comment = '^\s*\%(/\*\|%\)' + var lprolog_keyword = '^\s*sig\s\+\a' + var sml_comment = '^\s*(\*' + var sml_keyword = '^\s*\%(signature\|structure\)\s\+\a' + + var line = getline(nextnonblank(1)) + + if line =~ lprolog_comment || line =~# lprolog_keyword + setf lprolog + elseif line =~ sml_comment || line =~# sml_keyword + setf sml + endif +enddef + export def FTsys() if exists("g:filetype_sys") exe "setf " .. g:filetype_sys |