Changing theme background in Vim based on time

Sometimes it’s way better and convenient to use light background when the sun is shining. Conversely, a dark background will serve your eyes better late in the evening. If you’re lazy like me, you can automate it. Just add the following snippet to your Vim config.

if strftime("%H") < 16
  set background=light
  set background=dark

This protip has been written in 262 seconds