vim-airline / vim-airline-themes

A collection of themes for vim-airline
MIT License
2.05k stars 350 forks source link

[Feature Request] Support random theme #170

Closed voldikss closed 5 years ago

voldikss commented 5 years ago

Will airline support random theme like ZSH_THEME=random in oh-my-zsh?

Every time after Vim started, selecting a random them for users is quite interesting.

I've something like this in my vimrc and it works

function! Randnum(max) abort
  return str2nr(matchstr(reltimestr(reltime()), '\v\.@<=\d+')[1:]) % a:max
endfunction

let g:airline_themes_list = ['aurora', 'base16_spacemacs', 'cool', 'light', 'vice']
let g:randomn = Randnum(len(g:airline_themes_list))

if expand("%:t") == '.vimrc' && expand("%:p:h") ==# expand("~")
    exec "AirlineTheme " . g:airline_themes_list[g:randomn]
else
    let g:airline_theme = g:airline_themes_list[g:randomn]
endif

But I hope that it will be built in this plugin

chrisbra commented 5 years ago

you mean having a special theme random, that does perform something like your snippet above?

voldikss commented 5 years ago

Yes.

When I set the theme name as "random", the plug-in will pick a random theme for me:

let g:airline_theme='random'
voldikss commented 5 years ago

Thanks very much!

It has an error when I source $MYVIMRC, and I issued it here