*prism.txt* For Vim version 7.3 Last change: 2013-03-03 mmmmm mmmmm mmmmm mmmm m m~ # "# # "# # #" " ## ## #mmm#" #mmmm" # "#mmm # ## # # # "m # "# # "" # # # " mm#mm "mmm#" # #~ VIM REFERENCE MANUAL by Jan Pobrislo Help on using prism *prism* 1. Introduction |prism-intro| 3. Usage |prism-usage| 3. Configuration |prism-configuration| 4. Extending |prism-extending| ============================================================================== 1. INTRODUCTION *prism-intro* Prism is extensible parenthesis highlighter that applies different colors depending on nesting depth. This is commonly called "rainbow parenthesis". This plugin handles parenthesis "()", brackets "[]" and braces "{}" and is designed to work well with syntax highlighting rules for various languages. See |prism-extending| to see how to enable prism in your language of choice. ============================================================================== 2. USAGE *prism-usage* Prism uses after/syntax directory to extend your existing syntax rules, which is loaded automatically unless you set |g:prism_enabled| to 0. There are also two commands to toggle the variable and reload the filetype plugins: |PrismEnable| enables the prism syntax rules |PrismDisable| disables the prism syntax rules There are also two functions you can use for closing open brackets: PrismClose() returns string that will close all open brackets PrismCloseInner() returns string that will close innermost open bracket You can bind it such as ctrl-space closes the innermost open bracket: > :imoremap =PrismCloseInner() ============================================================================== 3. CONFIGURATION *prism-configuration* |g:prism_enabled| Set this to 0 to disable the syntax rules. |g:prism_dark_colors| Colors to use in terminal with dark background. |g:prism_light_colors| Colors to use in terminal with light background. ------------------------------------------------------------------------------ *g:prism_enabled* Enable defining syntax rules. This is what |PrismEnable| and |PrismDisable| does internally. ------------------------------------------------------------------------------ *g:prism_dark_colors* *g:prism_light_colors* List of colors for the parenthesis for color terminal for dark and bright backgrounds respectively. Numeric codes for 88 and 256 color terminals are also supported: > let g:prism_dark_colors = [ 31, 35, 113, 137, 130, 172, 191, 132, 140, 147 ] ============================================================================== 4. EXTENDING *prism-extending* To create syntax extension for your language create a file in after/syntax directory called filetype.vim (see |after-dir|). In this file call |Prism()| function: > call Prism(0, , ) Where and represents proper syntax elements defined in your language's syntax rules ------------------------------------------------------------------------------ *Prism()* Prism({maxdepth}, {contains}, {containedin}) Prism function applies the syntax rules to augment existing rule set. {maxdepth} Maximum number of colors to use, 0 is unlimited. {contains} String of comma-delimimited names of syntax rules that can appear inside the parenthesis. {containedin} String of comma-delimimited names of syntax regionsc that parenthesis that should be highlighted can appear in. To examine which regions are under cursor you can define following command: > fun! PStack() for id in synstack(line("."), col(".")) echo synIDattr(id, "name") endfor endfun command! PStack call PStack() vim:tw=78:ts=8:ft=help:norl: