[英]vim script: how to execute a command in a vim function
Why does the following: 为什么执行以下操作:
let s:colorschemes = ['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
? 不执行
colorscheme
? Vim complains with the following error 'cannot find colorschem s:name'. Vim抱怨以下错误“无法找到colorschem s:name”。 How do I tell it that I want it to derefence that variable and not apply it literally to :colorscheme?
如何告诉我我要它取消引用该变量,而不是将其从字面上应用于:colorscheme?
Have a look at this script from vim.wikia.com which does pretty much what you are asking for. 看一下vim.wikia.com上的该脚本,它几乎可以满足您的要求。
Key-line seems to be this one: 关键点似乎是这样的:
let nowcolors = 'elflord morning desert evening pablo'
execute 'colorscheme '.split(nowcolors)[i]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.