vim-patch:9.1.0876: filetype: openCL files are not recognized

Problem:  filetype: openCL files are not recognized
Solution: detect '*.cl' files as opencl or lisp filetype,
          include a opencl syntax and filetype plugin (Wu, Zhenyu)

closes: vim/vim#15825

e2c27ca8ef

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
This commit is contained in:
Christian Clason
2024-11-19 22:33:30 +01:00
committed by Christian Clason
parent 4c85c217d3
commit 23ead4f2cb
5 changed files with 53 additions and 2 deletions

View File

@@ -300,6 +300,7 @@ local extension = {
cho = 'chordpro',
chordpro = 'chordpro',
ck = 'chuck',
cl = detect.cl,
eni = 'cl',
icl = 'clean',
cljx = 'clojure',
@@ -688,7 +689,6 @@ local extension = {
ily = 'lilypond',
liquid = 'liquid',
liq = 'liquidsoap',
cl = 'lisp',
L = 'lisp',
lisp = 'lisp',
el = 'lisp',

View File

@@ -180,6 +180,16 @@ function M.changelog(_, bufnr)
return 'changelog'
end
--- @type vim.filetype.mapfn
function M.cl(_, bufnr)
local lines = table.concat(getlines(bufnr, 1, 4))
if lines:match('/%*') then
return 'opencl'
else
return 'lisp'
end
end
--- @type vim.filetype.mapfn
function M.class(_, bufnr)
-- Check if not a Java class (starts with '\xca\xfe\xba\xbe')