Skip to content

Commit f2283e4

Browse files
committed
Apply colorscheme after early return
There is no use in applying it first thing and this way we can deduce the mode without an extra argument.
1 parent af079ef commit f2283e4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

autoload/lumen.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,37 @@ func lumen#init()
2020
augroup END
2121
endfunc
2222

23-
func lumen#apply_colorscheme(mode)
23+
func lumen#apply_colorscheme()
2424
" apply colorscheme from g:lumen_light_colorscheme/g:lumen_dark_colorscheme
25-
let v = get(g:, printf("lumen_%s_colorscheme", a:mode), '')
25+
let v = get(g:, printf("lumen_%s_colorscheme", s:background), '')
2626
if len(v) && get(g:, 'colors_name', '') != v
2727
exe printf("colorscheme %s", v)
2828
endif
2929
endfunc
3030

3131
func lumen#light_hook()
32-
call lumen#apply_colorscheme('light')
33-
3432
if s:background == 'light' && &background == s:background
3533
return
3634
endif
3735

36+
3837
set background=light
3938
let s:background = &background
39+
call lumen#apply_colorscheme()
4040
if exists('#User#LumenLight')
4141
doautocmd User LumenLight
4242
endif
4343
endfunc
4444

4545
func lumen#dark_hook()
46-
call lumen#apply_colorscheme('dark')
47-
4846
if s:background == 'dark' && &background == s:background
4947
return
5048
endif
5149

50+
5251
set background=dark
5352
let s:background = &background
53+
call lumen#apply_colorscheme()
5454
if exists('#User#LumenDark')
5555
doautocmd User LumenDark
5656
endif

0 commit comments

Comments
 (0)