diff --git a/README.md b/README.md index 6a0af44..345523e 100644 --- a/README.md +++ b/README.md @@ -25,19 +25,18 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo ## Language packs -- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, ftdetect) +- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect) - [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax) - [c/c++](https://github.com/vim-jp/cpp-vim) (syntax) - [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect) - [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect) -- [css-color](https://github.com/gorodinskiy/vim-coloresque) (syntax) - [csv](https://github.com/chrisbra/csv.vim) (syntax, ftplugin, ftdetect) - [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect) - [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect) - [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect) - [erlang](https://github.com/oscarh/vimerl) (syntax, indent, compiler, autoload, ftplugin) - [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect) -- [go](https://github.com/jnwhiteh/vim-golang) (syntax, indent, autoload, ftplugin, ftdetect) +- [go](https://github.com/jnwhiteh/vim-golang) (syntax, indent, compiler, autoload, ftplugin, ftdetect) - [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect) - [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, ftplugin, ftdetect) - [haskell](https://github.com/travitch/hasksyn) (syntax, indent, ftplugin) @@ -52,7 +51,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [nginx](https://github.com/mutewinter/nginx.vim) (syntax, ftdetect) - [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin) - [octave](https://github.com/vim-scripts/octave.vim--) (syntax) -- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin) +- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin, ftdetect) +- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin, ftdetect) - [php](https://github.com/StanAngeloff/php.vim) (syntax) - [puppet](https://github.com/ajf/puppet-vim) (syntax, indent, ftplugin, ftdetect) - [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect) @@ -72,6 +72,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax) - [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect) - [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax) +- [css-color](https://github.com/gorodinskiy/vim-coloresque) (syntax) ## Contributing diff --git a/build b/build index 51cb430..052e739 100755 --- a/build +++ b/build @@ -92,6 +92,7 @@ PACKS=" nginx:mutewinter/nginx.vim ocaml:jrk/vim-ocaml octave:vim-scripts/octave.vim-- + opencl:petRUShka/vim-opencl perl:vim-perl/vim-perl php:StanAngeloff/php.vim puppet:ajf/puppet-vim diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index cdeb933..d33aa8e 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -82,6 +82,7 @@ if has("autocmd") au BufNewFile,BufRead *.mustache,*.handlebars,*.hbs,*.hogan,*.hulk,*.hjs set filetype=html syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim endif au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.conf if &ft == '' | setfiletype nginx | endif +au BufRead,BufNewFile *.cl set filetype=opencl autocmd BufNewFile,BufRead *.proto setfiletype proto au BufRead,BufNewFile *.pp set filetype=puppet au BufNewFile,BufRead *.rb,*.rbw,*.gemspec set filetype=ruby diff --git a/ftplugin/opencl.vim b/ftplugin/opencl.vim new file mode 100644 index 0000000..d89946f --- /dev/null +++ b/ftplugin/opencl.vim @@ -0,0 +1,15 @@ +if exists("b:did_ftplugin") | finish | endif + +if version > 600 + runtime! ftplugin/c.vim +endif + +" Smaller tab stops. +setlocal tabstop=4 +setlocal shiftwidth=4 + +" Smart tabbing/indenting +setlocal smarttab +setlocal smartindent + +let b:did_ftplugin = 1 diff --git a/indent/opencl.vim b/indent/opencl.vim new file mode 100644 index 0000000..2401ad3 --- /dev/null +++ b/indent/opencl.vim @@ -0,0 +1,10 @@ +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +if version > 600 + runtime! indent/c.vim +endif + +let b:did_indent = 1 diff --git a/syntax/opencl.vim b/syntax/opencl.vim new file mode 100644 index 0000000..fc7b315 --- /dev/null +++ b/syntax/opencl.vim @@ -0,0 +1,157 @@ +" Vim syntax file +" Language: OpenCL (Open Computing Language) +" Maintainer: Terence Ou (rivan_@msn.com) +" Last Change: 19-July-2010 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Read the C syntax to start with +if version < 600 + source :p:h/c.vim +else + runtime! syntax/c.vim +endif + +" address space qualifiers +syn keyword clStorageClass global __global local __local constant __constant private __private +" function qualifiers +syn keyword clStorageClass kernel __kernel __attribute__ +syn keyword clStorageClass read_only __read_only write_only __write_only +syn keyword clStorageClass complex imaginary + +" scalar types +syn keyword clType bool uchar ushort uint ulong half quad + +" vector types +syn keyword clType char2 char3 char4 char8 char16 +syn keyword clType uchar2 uchar3 uchar4 uchar8 uchar16 +syn keyword clType short2 short3 short4 short8 short16 +syn keyword clType ushort2 ushort3 ushort4 ushort8 ushort16 +syn keyword clType int2 int3 int4 int8 int16 +syn keyword clType uint2 uint3 uint4 uint8 uint16 +syn keyword clType long2 long3 long4 long8 long16 +syn keyword clType ulong2 ulong3 ulong4 ulong8 ulong16 +syn keyword clType float2 float3 float4 float8 float16 +syn keyword clType double2 double3 double4 double8 double16 +syn keyword clType half2 half3 half4 half8 half16 + +" other types +syn keyword clType ptrdiff_t intptr_t uintptr_t +syn keyword clType image2d_t image3d_t sampler_t event_t + +" reserved types +syn keyword clType bool2 bool3 bool4 bool8 bool16 +syn keyword clType quad2 quad3 quad4 quad8 quad16 +syn match clType "\(float\|double\)\(2\|3\|4\|8\|16\)x\(2\|3\|4\|8\|16\)" + +" abstract data types +syn keyword clType _cl_platform_id _cl_device_id _cl_context _cl_command_queue _cl_mem _cl_program _cl_kernel _cl_event _cl_sampler + +" image format descriptor structure +syn keyword clType cl_image_format + +syn keyword clCast vec_type_hint work_group_size_hint aligned packed endian + +syn match clCast "as_\(uchar\|char\|ushort\|short\|uint\|int\|ulong\|long\|float\|double\)(" + +syn match clCast "as_\(uchar\|char\|ushort\|short\|uint\|int\|ulong\|long\|float\|double\)\(2\|3\|4\|8\|16\)(" + +syn match clCast "convert_\(uchar\|char\|ushort\|short\|uint\|int\|ulong\|long\|float\|double\))\(2\|3\|4\|8\|16\)(" + +syn match clCast "convert_\(uchar\|char\|ushort\|short\|uint\|int\|ulong\|long\|float\|double\))\(2\|3\|4\|8\|16\)_sat(" + +syn match clCast "convert_\(uchar\|char\|ushort\|short\|uint\|int\|ulong\|long\|float\|double\))\(2\|3\|4\|8\|16\)_sat_\(rte\|rtz\|rtp\|rtn\)(" + +" work item functions +syn keyword clFunction get_work_dim get_global_size get_global_id get_local_size get_local_id get_num_groups get_group_id get_global_offset + +" math functions +syn keyword clFunction cos cosh cospi acos acosh acospi +syn keyword clFunction sin sincos sinh sinpi asin asinh asinpi +syn keyword clFunction tan tanh tanpi atan atan2 atanh atanpi atan2pi +syn keyword clFunction cbrt ceil copysign +syn keyword clFunction erfc erf +syn keyword clFunction exp exp2 exp10 expm1 +syn keyword clFunction fabs fdim floor fma fmax fmin +syn keyword clFunction fract frexp hypot ilogb +syn keyword clFunction ldexp ldexp lgamma lgamma_r +syn keyword clFunction log log2 log10 log1p logb +syn keyword clFunction mad modf +syn keyword clFunction nan nextafter +syn keyword clFunction pow pown powr +syn keyword clFunction remainder remquo rint rootn round rsqrt sqrt +syn keyword clFunction tgamma trunc +syn keyword clFunction half_cos half_divide half_exp half_exp2 half_exp10 half_log half_log2 half_log10 half_powr half_recip half_rsqrt half_sin half_sqrt half_tan +syn keyword clFunction native_cos native_divide native_exp native_exp2 native_exp10 native_log native_log2 native_log10 native_powr native_recip native_rsqrt native_sin native_sqrt native_tan + +" integer functions +syn keyword clFunction abs abs_diff add_sat hadd rhadd clz mad_hi mad_sat max min mul_hi rotate sub_sat upsample mad24 mul24 + +" common functions +syn keyword clFunction clamp degrees max min mix radians step smoothstep sign + +" geometric functions +syn keyword clFunction cross dot distance length normalize fast_distance fast_length fast_normalize + +" miscellaneous vector functions +syn keyword clFunction vec_step shuffle shuffle2 + +" relational functions +syn keyword clFunction isequal isnotequal isgreater isgreaterequal isless islessequal islessgreater isfinite isinf isnan isnormal isordered isunordered signbit any all bitselect select + +" vector data load and store functions +syn keyword clFunction vload_half vstore_half +syn match clFunction "vload\(2\|3\|4\|8\|16\)(" +syn match clFunction "vload_half\(2\|3\|4\|8\|16\)(" +syn match clFunction "vloada_half\(2\|3\|4\|8\|16\)(" +syn match clFunction "vloada_half\(2\|3\|4\|8\|16\)_\(rte\|rtz\|rtp\)(" +syn match clFunction "vstore\(2\|3\|4\|8\|16\)(" +syn match clFunction "vstore\(rte\|rtz\|rtp\|rtn\)(" +syn match clFunction "vstore_half\(2\|3\|4\|8\|16\)(" +syn match clFunction "vstore_half_\(rte\|rtz\|rtp\|rtn\)(" +syn match clFunction "vstore_half\(2\|3\|4\|8\|16\)_\(rte\|rtz\|rtp\|rtn\)(" +syn match clFunction "vstorea_half\(2\|3\|4\|8\|16\)(" +syn match clFunction "vstorea_half\(2\|3\|4\|8\|16\)_\(rte\|rtz\|rtp\|rtn\)(" + +" image read and write functions +syn match clFunction "read_image\(f\|i\|ui\|h\)(" +syn match clFunction "write_image\(f\|i\|ui\|h\)(" +syn keyword clFunction get_image_width get_image_height get_image_depth get_image_channel_data_type get_image_channel_order get_image_dim + +" explicit memory fence functions +syn keyword clFunction barrier mem_fence read_mem_fence write_mem_fence + +" async copies from global to local mem to and fro and prefetch +syn keyword clFunction async_work_group_copy async_work_group__strided_copy wait_group_events prefetch + +" atomic functions +syn match clFunction "atom_\(add\|sub\|xchg\|inc\|dec\|cmpxchg\|min\|max\|and\|or\|xor\)(" + +syn keyword clConstant MAXFLOAT HUGE_VALF INFINITY NAN +syn keyword clConstant FLT_DIG FLT_MANT_DIG FLT_MAX_10_EXP FLT_MAX_EXP FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_MAX FLT_MIN FLT_EPSILON +syn keyword clConstant CHAR_BIT CHAR_MAX CHAR_MIN INT_MIN INT_MAX LONG_MAX LONG_MIN SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN UCHAR_MAX UCHAR_MIN UINT_MAX ULONG_MAX +syn keyword clConstant DBL_DIG DBL_MANT_DIG DBL_MAX_10_EXP DBL_MIN_10_EXP DBL_MIN_EXP DBL_MAX DBL_MIN DBL_EPSILON +syn keyword clConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI2 M_PI4 M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2 +syn keyword clConstant CLK_NORMALIZED_COORDS_TRUE CLK_NORMALIZED_COORDS_FALSE +syn keyword clConstant CLK_ADDRESS_REPEAT CLK_ADDRESS_CLAMP_TO_EDGE CLK_ADDRESS_CLAMP +syn keyword clConstant CL_INTENSITY CL_RA CL_ARGB CL_BGRA CL_RGBA CL_R CL_RG CL_RGB CL_RGx CL_RGBx CL_Rx CL_A CL_LUMINANCE +syn keyword clConstant CL_SNORM_INT8 CL_SNORM_INT16 CL_UNORM_INT8 CL_UNORM_INT16 CL_UNORM_SHORT_565 CL_UNORM_SHORT_555 CL_UNORM_INT_101010 CL_SIGNED_INT8 CL_SIGNED_INT16 CL_SIGNED_INT32 CL_UNSIGNED_INT8 CL_UNSIGNED_INT16 CL_UNSIGNED_INT32 CL_HALF_FLOAT CL_FLOAT +syn keyword clConstant CLK_ADDRESS_NONE CLK_FILTER_NEAREST CLK_FILTER_LINEAR +syn keyword clConstant CLK_GLOBAL_MEM_FENCE CLK_LOCAL_MEM_FENCE + +hi def link clStorageClass StorageClass +hi def link clStructure Structure +hi def link clType Type +hi def link clVariable Identifier +hi def link clConstant Constant +hi def link clCast Operator +hi def link clFunction Function +hi def link clStatement Statement + +let b:current_syntax = "opencl" + +" vim: ts=8