Last active
May 29, 2017 10:23
-
-
Save veirus/678f2f919333505acc402bba16328b2b to your computer and use it in GitHub Desktop.
Set random colorscheme for yer Vim
This file contains 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! SetRandomColors() | |
if !exists('g:mycolors') | |
let matches = {} | |
for fname in split(globpath(&runtimepath, 'colors/*.vim'), '\n') | |
let name = fnamemodify(fname, ':t:r') | |
let matches[name] = 1 | |
endfor | |
let g:mycolors = sort(keys(matches), 1) | |
endif | |
exe 'colorscheme ' . g:mycolors[localtime() % len(g:mycolors)] | |
call SetCursorModes() | |
redraw | |
if has('title') | |
set titlelen=99 | |
set titlestring=%t%(\ %M%)\ -%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{g:colors_name} | |
endif | |
endfunction | |
command! Rcl call SetRandomColors() | |
map <F9> :call SetRandomColors()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment