Why does the following:
let s:color开发者_开发技巧schemes = ['synic', 'ir_black']
let s:colorscheme_idx = 0
function! RotateColorscheme()
let s:colorscheme_idx += 1
let s:name = s:colorschemes[s:colorscheme_idx]
echo s:name
colorscheme s:name
endfunction
not execute the colorscheme
? Vim complains with the following error 'cannot find colorschem s:name'. How do I tell it that I want it to derefence that variable and not apply it literally to :colorscheme?
Have a look at this script from vim.wikia.com which does pretty much what you are asking for.
Key-line seems to be this one:
let nowcolors = 'elflord morning desert evening pablo'
execute 'colorscheme '.split(nowcolors)[i]
精彩评论