Vim highlighting for PyOpenCL
© Andreas Kloeckner 2011, MIT license
Uses parts of mako.vim by Armin Ronacher.
I recommend to use Pathogen (www.vim.org/scripts/script.php?script_id=2332) to organize Vim plugins. In this case you should do following:
cd ~/.vim/bundle git clone git://github.com/petRUShka/vim-pyopencl.git
Then do
:set filetype=pyopencl
and use
"""//CL// ...code..."""
for OpenCL code included in your Python file.
For example
cl.Program(ctx, """ __kernel void sum(__global const float *a, __global const float *b, __global float *c) { int gid = get_global_id(0); c[gid] = a[gid] + b[gid]; } """).build()
will not be highlighted. But
cl.Program(ctx, """//CL// __kernel void sum(__global const float *a, __global const float *b, __global float *c) { int gid = get_global_id(0); c[gid] = a[gid] + b[gid]; } """).build()
will be highlighted.
You may also include a line
# vim: filetype=pyopencl.python
at the end of your file to set the file type automatically.
Optional: Install opencl.vim from github.com/petRUShka/vim-opencl
Vim-opencl is a vim plugin for support OpenCL (Open Computing Language) syntax files (*.cl).
Originally, this was a mirror of github.com/inducer/pyopencl/blob/master/contrib/pyopencl.vim
That script provides syntax highlight for PyOpenCL syntax files and included to pyopencl package: github.com/inducer/pyopencl .