From 4805c6248fb785e2d1dde526c8948700ac8858cc Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Mon, 23 May 2016 21:36:49 -0400 Subject: [PATCH] Support different theme when changing vim background mode --- vimrc | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/vimrc b/vimrc index 529bb2e..cd3699a 100644 --- a/vimrc +++ b/vimrc @@ -172,17 +172,33 @@ autocmd bufread,bufnewfile *.lisp,*.scm,*.rkt setlocal equalprg=scmindent.rkt """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " COLORS """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -colorscheme pencil -" default to dark, can also use 'light' -set background=dark +let s:default_bg = 'dark' +let s:dark_theme = 'monokai' +let s:light_theme = 'pencil' let g:airline_theme = 'pencil' -" Switch between light and dark -map l :call ChangeBgTheme("dark") -map ll :call ChangeBgTheme("light") +if s:default_bg =~ 'light' + " The order that these are set matters for some themes + exe 'colorscheme ' . s:light_theme + set background=light +else + exe 'colorscheme ' . s:dark_theme + set background=dark +endif -function! ChangeBgTheme(theme) - exec ":set background=" . a:theme +" Switch between light and dark +map l :call ChangeBgTheme('dark') +map ll :call ChangeBgTheme('light') + +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 exec ":RainbowParenthesesToggle" exec ":RainbowParenthesesToggle"