Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support random theme #170

Closed
voldikss opened this issue Mar 26, 2019 · 3 comments
Closed

[Feature Request] Support random theme #170

voldikss opened this issue Mar 26, 2019 · 3 comments

Comments

@voldikss
Copy link

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
Copy link
Member

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

@voldikss
Copy link
Author

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
Copy link
Author

Thanks very much!

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

YCbCr pushed a commit to YCbCr/vim-airline that referenced this issue May 26, 2019
You can now specify the special theme name `random` and vim-airline will
load a random theme from the ones installed. This works from either your
.vimrc as well as when calling `:AirlineTheme` command directly.

closes vim-airline/vim-airline-themes#170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants