diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2022-07-01 07:08:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-01 07:08:44 +0200 |
| commit | 60604d6a9982319673e5d5e67f0cdc29465cfe54 (patch) | |
| tree | 2baba7d4452112cec108cf013ae35794539f5de7 /runtime/lua/vim/filetype | |
| parent | 8f5bcfb0e4ca3b827bcc46cb05d3530bd97da7db (diff) | |
| download | rneovim-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/lua/vim/filetype')
| -rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 342f947524..14a4381835 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -922,6 +922,23 @@ function M.rules(path) end end +-- LambdaProlog and Standard ML signature files +function M.sig(bufnr) + if vim.g.filetype_sig then + return vim.g.filetype_sig + end + + local line = nextnonblank(bufnr, 1) + + -- LambdaProlog comment or keyword + if findany(line, { '^%s*/%*', '^%s*%%', '^%s*sig%s+%a' }) then + return 'lprolog' + -- SML comment or keyword + elseif findany(line, { '^%s*%(%*', '^%s*signature%s+%a', '^%s*structure%s+%a' }) then + return 'sml' + end +end + -- This function checks the first 25 lines of file extension "sc" to resolve -- detection between scala and SuperCollider function M.sc(bufnr) |