开发者

vim script: how to execute a command in a vim function

开发者 https://www.devze.com 2023-04-09 02:12 出处:网络
Why does the following: let s:color开发者_开发技巧schemes = [\'synic\', \'ir_black\'] let s:colorscheme_idx = 0

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消