Created
December 18, 2014 00:56
-
-
Save vagmi/e29f42d2f2f11bdfc81f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! RandomNumber(limit) | |
let components = split(reltimestr(reltime()), '\.') | |
let microseconds = components[-1] + 0 | |
return microseconds % a:limit | |
endfunction | |
function! RandomScheme() | |
let choices = [] | |
for fname in split(globpath(&runtimepath, 'colors/*.vim'), '\n') | |
let name = fnamemodify(fname, ':t:r') | |
let choices = choices + [name] | |
endfor | |
let index = RandomNumber(len(choices)) | |
execute 'colorscheme' fnameescape(choices[index]) | |
endfunction | |
let g:total=1 | |
function! SwitchScheme() | |
call feedkeys("f\e") | |
if(g:total % 15 == 0) | |
" update time is usually set to 4 seconds | |
" So the scheme would be changed on 1 minute of inactivity | |
call RandomScheme() | |
endif | |
let g:total = g:total + 1 | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment