aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-07-01 07:08:44 +0200
committerGitHub <noreply@github.com>2022-07-01 07:08:44 +0200
commit60604d6a9982319673e5d5e67f0cdc29465cfe54 (patch)
tree2baba7d4452112cec108cf013ae35794539f5de7 /runtime/autoload
parent8f5bcfb0e4ca3b827bcc46cb05d3530bd97da7db (diff)
downloadrneovim-60604d6a9982319673e5d5e67f0cdc29465cfe54.tar.gz
rneovim-60604d6a9982319673e5d5e67f0cdc29465cfe54.tar.bz2
rneovim-60604d6a9982319673e5d5e67f0cdc29465cfe54.zip
vim-patch:9.0.0012: signature files not detected properly (#19172)
Problem: Signature files not detected properly. Solution: Add a function to better detect signature files. (Doug Kearns) https://github.com/vim/vim/commit/cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/dist/ft.vim23
1 files changed, 22 insertions, 1 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index e7f71e0f78..a3a67cacb9 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -459,7 +459,7 @@ func dist#ft#FTmm()
setf nroff
endfunc
-" Returns true if file content looks like LambdaProlog
+" Returns true if file content looks like LambdaProlog module
func IsLProlog()
" skip apparent comments and blank lines, what looks like
" LambdaProlog comment may be RAPID header
@@ -847,6 +847,27 @@ func dist#ft#FTperl()
return 0
endfunc
+" LambdaProlog and Standard ML signature files
+func dist#ft#FTsig()
+ if exists("g:filetype_sig")
+ exe "setf " .. g:filetype_sig
+ return
+ endif
+
+ let lprolog_comment = '^\s*\%(/\*\|%\)'
+ let lprolog_keyword = '^\s*sig\s\+\a'
+ let sml_comment = '^\s*(\*'
+ let sml_keyword = '^\s*\%(signature\|structure\)\s\+\a'
+
+ let line = getline(nextnonblank(1))
+
+ if line =~ lprolog_comment || line =~# lprolog_keyword
+ setf lprolog
+ elseif line =~ sml_comment || line =~# sml_keyword
+ setf sml
+ endif
+endfunc
+
func dist#ft#FTsys()
if exists("g:filetype_sys")
exe "setf " .. g:filetype_sys