aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-11-19 22:33:30 +0100
committerChristian Clason <ch.clason+github@icloud.com>2024-11-20 09:31:15 +0100
commit23ead4f2cb19b05d83f1c515b35bd5896ee77365 (patch)
tree4da1c530e49d60f817c25d76d8eb8ffc35e8bbc0 /runtime/lua/vim
parent4c85c217d384c79013401f09b329467c53c8a01c (diff)
downloadrneovim-23ead4f2cb19b05d83f1c515b35bd5896ee77365.tar.gz
rneovim-23ead4f2cb19b05d83f1c515b35bd5896ee77365.tar.bz2
rneovim-23ead4f2cb19b05d83f1c515b35bd5896ee77365.zip
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 https://github.com/vim/vim/commit/e2c27ca8eff7cc8ec852b531d5a7f328a343a761 Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype.lua2
-rw-r--r--runtime/lua/vim/filetype/detect.lua10
2 files changed, 11 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index c23beb960c..285b7e2328 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -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',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 98b001bd51..81b94c69db 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -181,6 +181,16 @@ function M.changelog(_, bufnr)
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')
if not getline(bufnr, 1):find('^\202\254\186\190') then