Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a "build directory" in vim?

Tags:

vim

ide

build

Is there a way to tell vim to run the makeprg in a specific directory? I use per-project .vimrc files, and they would seem the perfect place to inform vim of where each project should be built, regardless of the current directory.

like image 983
static_rtti Avatar asked Jul 04 '11 09:07

static_rtti


1 Answers

 :let &makeprg='(cd /tmp && make)'

seems to work nicely for me

 :se makepgr="(cd %:h/.. && make)" 

to make it go to the parent directory

Note

The above worked on windows when I tried it; Today on linux I found out that I somehow had to use the following incantations to get the same to work:

:let &makeprg='(cd %:h/.. && make)'

Note I'm assuming you don't actually use make, because that would be a simple :make -C /tmp away

Note most other automated build systems have a similar option, e.g. :!scons -C /tmp

like image 120
sehe Avatar answered Oct 08 '22 13:10

sehe