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: #15825
Signed-off-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
a13bd294ab
commit
e2c27ca8ef
8
runtime/autoload/dist/ft.vim
vendored
8
runtime/autoload/dist/ft.vim
vendored
@ -144,6 +144,14 @@ export def FTcfg()
|
||||
endif
|
||||
enddef
|
||||
|
||||
export def FTcl()
|
||||
if join(getline(1, 4), '') =~ '/\*'
|
||||
setf opencl
|
||||
else
|
||||
setf lisp
|
||||
endif
|
||||
enddef
|
||||
|
||||
export def FTcls()
|
||||
if exists("g:filetype_cls")
|
||||
exe "setf " .. g:filetype_cls
|
||||
|
||||
@ -1365,14 +1365,17 @@ au BufNewFile,BufRead lilo.conf setf lilo
|
||||
" Lilypond
|
||||
au BufNewFile,BufRead *.ly,*.ily setf lilypond
|
||||
|
||||
" Lisp (*.el = ELisp, *.cl = Common Lisp)
|
||||
" Lisp (*.el = ELisp)
|
||||
" *.jl was removed, it's also used for Julia, better skip than guess wrong.
|
||||
if has("fname_case")
|
||||
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,*.cl,*.L,.emacs,.sawfishrc,*.stsg,*/supertux2/config setf lisp
|
||||
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,*.L,.emacs,.sawfishrc,*.stsg,*/supertux2/config setf lisp
|
||||
else
|
||||
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,*.cl,.emacs,.sawfishrc,*.stsg,*/supertux2/config setf lisp
|
||||
au BufNewFile,BufRead *.lsp,*.lisp,*.asd,*.el,.emacs,.sawfishrc,*.stsg,*/supertux2/config setf lisp
|
||||
endif
|
||||
|
||||
" *.cl = Common Lisp or OpenCL
|
||||
au BufNewFile,BufRead *.cl call dist#ft#FTcl()
|
||||
|
||||
" SBCL implementation of Common Lisp
|
||||
au BufNewFile,BufRead sbclrc,.sbclrc setf lisp
|
||||
|
||||
|
||||
12
runtime/ftplugin/opencl.vim
Normal file
12
runtime/ftplugin/opencl.vim
Normal file
@ -0,0 +1,12 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: OpenCL
|
||||
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
|
||||
" Last Change: 2024 Nov 19
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
|
||||
setlocal commentstring=/*\ %s\ */ define& include&
|
||||
|
||||
let b:undo_ftplugin = "setl commentstring< comments<"
|
||||
13
runtime/syntax/opencl.vim
Normal file
13
runtime/syntax/opencl.vim
Normal file
@ -0,0 +1,13 @@
|
||||
" Vim syntax file
|
||||
" Language: OpenCL
|
||||
" Last Change: 2024 Nov 19
|
||||
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" TODO: support openCL specific keywords
|
||||
runtime! syntax/c.vim
|
||||
|
||||
let current_syntax = "opencl"
|
||||
Reference in New Issue
Block a user