Create a gist now

Instantly share code, notes, and snippets.

@aaronbieber /vimrc forked from garrettoreilly/vimrc
Last active Dec 17, 2015

What would you like to do?
" Set colorscheme to solarized
colorscheme solarized
" Change the Solarized background to dark or light depending upon the time of
" day (5 refers to 5AM and 17 to 5PM). Change the background only if it is not
" already set to the value we want.
function! SetSolarizedBackground()
if strftime("%H") >= 5 && strftime("%H") < 17
if &background != 'light'
set background=light
if &background != 'dark'
set background=dark
" Every time you save a file, call the function to check the time and change
" the background (if necessary).
if has("autocmd")
autocmd bufwritepost * call SetSolarizedBackground()
" vim: set et tw=4 sw=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment