Skip to content

Instantly share code, notes, and snippets.

@imwilsonxu
Created July 19, 2013 16:04
Show Gist options
  • Save imwilsonxu/6040324 to your computer and use it in GitHub Desktop.
Save imwilsonxu/6040324 to your computer and use it in GitHub Desktop.
Set Vim colorscheme by time of day, an example from book Learning Vi and Vim.
function SetTimeOfDayColors()
let g:Favcolorschemes = ["darkblue", "morning", "shine", "evening"]
let g:CurrentHour = (strftime("%H") + 0) / 6
if g:colors_scheme !~ g:Favcolorschemes[g:CurrentHour]
execute "colorscheme " . g:Favcolorschemes[g:CurrentHour]
redraw
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment