Tuesday, December 29, 2015

Re: How to pass format string to ?

On Tuesday, December 29, 2015 at 10:53:31 PM UTC-6, jimmy yuan wrote:
> I want to auto load CCTree, find in parent recursion.
>
> command! -nargs=? -complete=file CCTreeLoadDB  call s:CCTreeCmdLine.mLoadDB(<q-args>, s:DBClasses.cscopeid)
>
> function! LoadCCTreeParent()
>     let newcsdbpath = FindInParent("cscope.out",WindowDir(),$HOME)
>     if newcsdbpath != "Nothing"
>         let b:csdbpath = newcsdbpath
>         "CCTreeLoadDB b:csdbpath . "cscope.out"
>     endif
> endfunc
>
> augroup AutoLoadCCTree
>     au!
>     au BufEnter *.[chly]  call LoadCCTreeParent()
>     au BufEnter *.cc      call LoadCCTreeParent()
> augroup END
>
> CCTreeLoadDB does not use the format string.How can I done it?

CCTreeLoadDB is defined to take arguments, not an expression. You are passing the literal string "b:csdbpath" to it rather than the value of that variable.

You need to use the :execute command. E.g.:

execute "CCTreeLoadDB" b:csdbpath . "cscope.out"

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: