Saturday, April 3, 2010

vim scripting - using variables

I'm trying to integrate cscope with vim. The standard method to load the
cscope.out file is simply:

if filereadable("cscope.out")
cs add cscope.out
endif

But this requires always starting vim from the directory with the cscope.out
file. Yuk.

So, I've written a function that scans upward until if find the cscope.out
file, and stores that in a variable. For example s:csfile might end up
"../../cscope.out"

However,

cs add s:csfile

doesn't work! It is trying to actually open a file called "s:csfile". How
do I make vim translate this variable into a literal so that "cs add" will
work???

Thanks.
--
View this message in context: http://old.nabble.com/vim-scripting---using-variables-tp28128378p28128378.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe, reply using "remove me" as the subject.

No comments:

Post a Comment