Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid single line if statements #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions autoload/rainbow.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Copyright 2013 LuoChen ([email protected]). Licensed under the Apache License 2.0.

if exists('s:loaded') | finish | endif | let s:loaded = 1
if exists('s:loaded')
finish
endif
let s:loaded = 1

fun s:trim(s)
return substitute(a:s, '\v^\s*(.{-})\s*$', '\1', '')
Expand Down Expand Up @@ -79,7 +82,11 @@ fun rainbow#syn(config)
exe 'syn cluster '.prefix.'Regions contains='.join(map(range(cycle), '"@".s:synGroupID(prefix, "Regions", v:val)'), ',')
exe 'syn cluster '.prefix.'Parentheses contains='.join(map(range(cycle), '"@".s:synGroupID(prefix, "Parentheses", v:val)'), ',')
exe 'syn cluster '.prefix.'Operators contains='.join(map(range(cycle), '"@".s:synGroupID(prefix, "Operators", v:val)'), ',')
if has_key(conf, 'after') | for cmd in conf.after | exe cmd | endfor | endif
if has_key(conf, 'after')
for cmd in conf.after
exe cmd
endfor
endif
endfun

fun rainbow#syn_clear(config)
Expand Down
4 changes: 3 additions & 1 deletion autoload/rainbow_main.vim
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ fun rainbow_main#load()
endfun

fun rainbow_main#clear()
if !exists('b:rainbow_confs') | return | endif
if !exists('b:rainbow_confs')
return
endif
for conf in b:rainbow_confs
call rainbow#hi_clear(conf)
call rainbow#syn_clear(conf)
Expand Down
5 changes: 4 additions & 1 deletion plugin/rainbow_main.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
" Copyright 2013 LuoChen ([email protected]). Licensed under the Apache License 2.0.

if exists('s:loaded') || !(exists('g:rainbow_active') || exists('g:rainbow_conf')) | finish | endif | let s:loaded = 1
if exists('s:loaded') || !(exists('g:rainbow_active') || exists('g:rainbow_conf'))
finish
endif
let s:loaded = 1

command! RainbowToggle call rainbow_main#toggle()
command! RainbowToggleOn call rainbow_main#load()
Expand Down