Last Updated: March 13, 2016
·
6.628K
· garrett_oreilly

Use Solarized in your Vim? Use Light during the day and Dark at night!

Do the following in your .vimrc!

Set your color scheme to solarized!

colorscheme solarized

Launch vim with light background during the day and dark at night.

if strftime("%H") >= 5 && strftime("%H") <= 17
  set background=light
else
  set background=dark
endif

Source ~/.vimrc any time you save a file, so the background color will change if it becomes day/night.

if has("autocmd")
  autocmd bufwritepost * source ~/.vimrc
endif

1 Response
Add your response

Great work
You can also add this to your .bash_profile given that you have the terminal themes
you can get theme from https://github.com/tomislav/osx-terminal.app-colors-solarized
and :) your good to go day and night


h=$((date +"%H"))
if [ "$h" -ge 5 ] && [ "$h" -le 17 ]; then

osascript <<'END'
tell application "Terminal"
set current settings of tabs of windows to settings set "Solarized Light"
end tell
END

else

osascript <<'END'
tell application "Terminal"
set current settings of tabs of windows to settings set "Solarized Dark"
end tell
END

fi

over 1 year ago ·