vim-glsl

View the Project on GitHub petrbroz/vim-glsl

glsl.vim

Provides basic functionality such as syntax highlighting or code folding for standard OpenGL ES 1.0 shaders, and for additional directives used in three.js (for example, #include).

Supported file extensions: .glsl, .vs, .fs

Demo

Installation

cd ~/.vim/bundle && git clone git://github.com/petrbroz/vim-glsl.git
Plugin 'petrbroz/vim-glsl'
NeoBundle 'petrbroz/vim-glsl'

Features

Syntax highlighting

Based on WebGL 1.0 specs. Additionally, #include directives used in three.js are also recognized.

Code folding

Simply based on cindent.

Reference documentation

The built-in variables, constants, and functions of OpenGL ES GLSL are documented using vim's docs format, so you can look up the documentation using something like :h texture2D(), or just hit K while the cursor is on the function.

If these don't work, you may need to update your help tags. See :h helptags for more information.

Autocomplete

The same reference documentation mentioned above is used to provide the user-defined autocompletion. Hit ctrl-x ctrl-u while in insert mode to invoke it. If you want to use omnicompletion instead (ctrl-x ctrl-o), add the following line to your .vimrc file:

set omnifunc=glsl#CompleteFunc

Go to shader chunk

With cursor inside the brackets of the #include<foo> directive, gf will try to find foo.glsl, foo.vs, or foo.fs in the subtree of the current working directory.

License

Distributed under the same terms as Vim. See :help license.