1

How can I run vim-rooter's function FindRootDirectory() instead of /vagrant/my_project? I have tried multiple variations like:

set makeprg=FindRootDirectory().'/app/Console/cake test '.expand('%:p')
set makeprg=FindRootDirectory()."/app/Console/cake" test %:p

+++UPDATE+++

let &makeprg=FindRootDirectory()."/app/Console/cake test %:p" does work, but I'm also getting a black screen instead of my previous opened file. Do you know how can I get only results in the bottom?

And I'm getting this errors after running the vim command:

E117: 未知の関数です(Unknown function): FindRootDirectory
E15: 無効な式です(Invalid expression): FindRootDirectory()."/app/Console/cake test %:p"

+++UPDATE+++

Was able to solve it by:

autocmd VimEnter * let &makeprg=FindRootDirectory()."/app/Console/cake test %:p"
2
  • 1
    You seem to have a lot of problems with something called "QuickRun". Whatever it is, don't you think you should read that thing's documentation and/or use its issue tracker?
    – romainl
    Commented Feb 16, 2016 at 12:04
  • @romainl thank you. I read it, but didn't get it ^^
    – whitesiroi
    Commented Feb 17, 2016 at 2:45

1 Answer 1

6

Use :let &makeprg instead of :set. The latter expects an un-quoted string.

4
  • If I understood it right, this will have to be done each time OP switches to something with a different root directory, i.e, there's no way to evaluate what the root directory is when :make is called.
    – muru
    Commented Feb 16, 2016 at 18:13
  • @Luc Hermitte Thank you very much. let &makeprg=FindRootDirectory()."/app/Console/cake test %:p" does work, but I'm also getting a black screen instead of my previous opened file. Do you know how can I get only results in the bottom? I attach screenshot and update my question. Thank you.
    – whitesiroi
    Commented Feb 17, 2016 at 2:00
  • @muru I have tried with several projects and :silent! make | copen does work great.
    – whitesiroi
    Commented Feb 17, 2016 at 2:36
  • Looks like you need to source the plugin where this function is defined before calling it. Commented Feb 17, 2016 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.