Support different theme when changing vim background mode
This commit is contained in:
parent
2066b83431
commit
4805c6248f
32
vimrc
32
vimrc
|
@ -172,17 +172,33 @@ autocmd bufread,bufnewfile *.lisp,*.scm,*.rkt setlocal equalprg=scmindent.rkt
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" COLORS
|
" COLORS
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
colorscheme pencil
|
let s:default_bg = 'dark'
|
||||||
" default to dark, can also use 'light'
|
let s:dark_theme = 'monokai'
|
||||||
set background=dark
|
let s:light_theme = 'pencil'
|
||||||
let g:airline_theme = 'pencil'
|
let g:airline_theme = 'pencil'
|
||||||
|
|
||||||
" Switch between light and dark
|
if s:default_bg =~ 'light'
|
||||||
map <leader>l :call ChangeBgTheme("dark")<cr>
|
" The order that these are set matters for some themes
|
||||||
map <leader>ll :call ChangeBgTheme("light")<cr>
|
exe 'colorscheme ' . s:light_theme
|
||||||
|
set background=light
|
||||||
|
else
|
||||||
|
exe 'colorscheme ' . s:dark_theme
|
||||||
|
set background=dark
|
||||||
|
endif
|
||||||
|
|
||||||
function! ChangeBgTheme(theme)
|
" Switch between light and dark
|
||||||
exec ":set background=" . a:theme
|
map <leader>l :call ChangeBgTheme('dark')<cr>
|
||||||
|
map <leader>ll :call ChangeBgTheme('light')<cr>
|
||||||
|
|
||||||
|
function! ChangeBgTheme(bg)
|
||||||
|
if a:bg =~ 'light'
|
||||||
|
let s:theme = s:light_theme
|
||||||
|
else
|
||||||
|
let s:theme = s:dark_theme
|
||||||
|
endif
|
||||||
|
|
||||||
|
exe 'colorscheme ' . s:theme
|
||||||
|
exe 'set background=' . a:bg
|
||||||
" Have to run this twice to get the plugin to set the colors
|
" Have to run this twice to get the plugin to set the colors
|
||||||
exec ":RainbowParenthesesToggle"
|
exec ":RainbowParenthesesToggle"
|
||||||
exec ":RainbowParenthesesToggle"
|
exec ":RainbowParenthesesToggle"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user