Skip to content

Instantly share code, notes, and snippets.

@muralisc
Last active December 29, 2016 13:49
Show Gist options
  • Save muralisc/a27d69c4b44c1f3cc3f50c83f0394e3e to your computer and use it in GitHub Desktop.
Save muralisc/a27d69c4b44c1f3cc3f50c83f0394e3e to your computer and use it in GitHub Desktop.
Load colorscheme depending on the day of month
" load colorscheme depending on the day of month {{{
fu! s:LoadRandomColorScheme()
let s:color_file_list = globpath(&runtimepath, 'colors/*.vim' )
let s:color_file_list = substitute(s:color_file_list, '\' , '/', 'g')
let s:color_file_list = substitute(s:color_file_list, "\n" , ',', 'g')
let s:color_file_list = substitute(s:color_file_list, '\(/[^,]\+/\)' , '', 'g')
let s:color_file_list = substitute(s:color_file_list, '\.vim' , '', 'g')
" echo s:color_file_list
if strlen(s:color_file_list)
let s:no_of_commas = substitute(s:color_file_list, '\([^,]\+\)', '', 'g')
if s:color_file_list =~ ','
let s:rnd = (strftime( "%d" ) + 0)% ( strlen(s:no_of_commas) +1 )
" echo strlen(s:no_of_commas)
let s:loop = 0
while s:loop < s:rnd
let s:color_file_list = substitute(s:color_file_list, '^\([^,]\+\),', '', '')
let s:loop = s:loop + 1
endwhile
" echo s:color_file_list
let s:color_file = matchstr(s:color_file_list, '^[^,]\+')
" echo s:color_file
execute "colorscheme" s:color_file
unlet! s:color_file
unlet! s:loop
unlet! s:rnd
endif
endif
unlet! s:color_file_list
unlet! s:self_file
endf
call s:LoadRandomColorScheme()
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment