开发者

vim variable declaration

I added following line of code in .vimrc

let g:jslint_status = 'enabled'

if exists("jslint_st开发者_运维技巧atus")
  echo jstlint_status
else
  echo 'not found'
endif

Error message

E121: Undefined variable: jstlint_status
E15: Invalid expression: jstlint_status

What am I doing wrong?


Double-check your spelling. You're checking if jslint_statusexists, but you're echoing jstlint_status. Notice that extra T - the third character in the misspelled variable name.


Whenever I find myself in this kind of situation, I try searching for the variable and with incrsearch on you get to see whether all the relevant portions are highlighted.

In this case, if you had searched for jstlint_status sure enough the assignment operation wont be highlighted.

As kemp points out in the comments, you could hit * on the variable of instance and see if the assignment operation is highlighted or not. It amazes how useful * is. No wonder it is called the Super Star

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜