From a145fbc3710b0859638cd1e640d78b825b98a491 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Fri, 9 Feb 2018 12:07:29 +0000 Subject: Fix colorscheme in vim --- vim/.vimrc | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'vim') diff --git a/vim/.vimrc b/vim/.vimrc index 12cb7de..b8d494b 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -331,8 +331,31 @@ nnoremap ]B ]b:bd! # " }}} "" Colorscheme {{{ -let g:airline_theme='deus' -colo seoul256 +function! SaveColo(...) + if &runtimepath =~ 'airline' + execute 'set background='.a:1 + execute 'AirlineTheme' a:3 + execute 'colorscheme' a:2 + endif + execute 'silent !echo "set background='.a:1.'" > ~/.color.vim' + execute 'silent !echo "colorscheme '.a:2.'" >> ~/.color.vim' + execute 'silent !echo "let g:airline_theme=\"'.a:3.'\"" >> ~/.color.vim' +endfunction +function! MyColo(colorscheme) + if a:colorscheme == "solarized" + call SaveColo("light","solarized","solarized") + elseif a:colorscheme == "seoul" + call SaveColo("dark","seoul256","deus") + endif +endfunction +if filereadable($HOME."/.color.vim") + source ~/.color.vim +else + call MyColo("seoul") +endif +nnoremap ,c :call MyColo("") +nnoremap ,cl :call MyColo("solarized") +nnoremap ,cs :call MyColo("seoul") " }}} "" Autocommands {{{ augroup vimrc -- cgit v1.2.3