这个(vimscript)代码有什么问题?

时间:2011-03-22 10:37:18

标签: vim

有谁知道为什么这从不起作用:

if !exists("g:removenumbchar")
  if a:type == "remove"
   let g:removenumbchar = "How many characters do you want remove at the end?"
  elseif a:type == "add"
   let g:removenumbchar = "How many characters do you want add at the end?"
  endif
endif  
let c = inputdialog(g:removenumbchar)

即使“a:type”值正确,有时它会显示第一个句子,有时也会显示第二个句子。 我从来都不明白这是怎么回事。

1 个答案:

答案 0 :(得分:2)

好吧,g:removenumbchar将持续调用我认为存在的函数,所以在你调用它之后,每次都会得到相同的消息,不管a:type中的内容是什么后续电话。那可能是你所看到的吗?

相关问题