Skip to content

Commit

Permalink
switch 'loaded' to buffer local
Browse files Browse the repository at this point in the history
  • Loading branch information
kien committed Oct 26, 2011
1 parent 8f70517 commit 67c3105
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions autoload/rainbow_parentheses.vim
Expand Up @@ -82,17 +82,19 @@ endfunc
cal s:cluster()

let s:types = [['(',')'],['\[','\]'],['{','}'],['<','>']]
let s:loaded = [0,0,0,0]

func! rainbow_parentheses#load(...)
let [level, grp, alllvls, type] = ['', '', [], s:types[a:1]]
for each in range(1, s:max)
cal add(alllvls, 'level'.each)
endfor
let s:loaded[a:1] = s:loaded[a:1] ? 0 : 1
if !exists('b:loaded')
let b:loaded = [0,0,0,0]
endif
let b:loaded[a:1] = b:loaded[a:1] ? 0 : 1
for each in range(1, s:max)
let region = s:loaded[a:1] ? 'level'.each : 'level'.each.'none'
let grp = s:loaded[a:1] ? 'level'.each.'c' : 'Normal'
let region = b:loaded[a:1] ? 'level'.each : 'level'.each.'none'
let grp = b:loaded[a:1] ? 'level'.each.'c' : 'Normal'
let cmd = 'syn region %s matchgroup=%s start=/%s/ end=/%s/ contains=TOP,%s,NoInParens'
exe printf(cmd, region, grp, type[0], type[1], join(alllvls, ','))
cal remove(alllvls, 0)
Expand Down

0 comments on commit 67c3105

Please sign in to comment.