Home

Awesome

NOTICE

This is a fork of https://github.com/oblitum/rainbow

Rainbow Parentheses Improved

This is a fork of Rainbow Parentheses Improved by luo chen.

I've applied some minor corrections and modifications:

Chevrons are a hard case to deal with. To distinguish "less than" from "bracket for open generics argument list" it's assumed that "less than" will always be surrounded by spaces. If not, it'll be treated as an open template's angle bracket (although, still some checking applies for the template or operator keyword, for C++ for example).

Installation

Vundle : Add this to .vimrc

Plugin 'frazrepo/vim-rainbow'

Simple Configuration

Put this on your .vimrc for loading it for specific file types:

au FileType c,cpp,objc,objcpp call rainbow#load()

or just this to enable it globally:

let g:rainbow_active = 1

Advanced Configuration

An advanced configuration allows you to define what parentheses to use for each type of file. You can also determine the colors of your parentheses by this way (read file vim73/rgb.txt for all named colors).

e.g. this is an advanced config (add these sentences to your .vimrc):

let g:rainbow_active = 1

let g:rainbow_load_separately = [
    \ [ '*' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
    \ [ '*.tex' , [['(', ')'], ['\[', '\]']] ],
    \ [ '*.cpp' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
    \ [ '*.{html,htm}' , [['(', ')'], ['\[', '\]'], ['{', '}'], ['<\a[^>]*>', '</[^>]*>']] ],
    \ ]

let g:rainbow_guifgs = ['RoyalBlue3', 'DarkOrange3', 'DarkOrchid3', 'FireBrick']
let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta']

User Command

:RainbowToggle  --you can use it to toggle this plugin.
:RainbowLoad    --you can use it to load/reload this plugin.

Screenshots

Here's a sample of a dark gruvbox vim session:

<a href="http://i.imgur.com/J67VbFM.png">Dark VIM Session</a>

and here's a slightly lighter dark solarized session:

<a href="http://i.imgur.com/j4g6L92.png">Lighter VIM Session</a>