Hi Ilia,

to me it looks like you always want to compile using the Makefile in ProjectDir. I don't know if this helps much, but I would recommend to open the Makefile in one buffer, then hide it:

:hid

and do your source editing. When you want to compile your files, use

:sb Mak<tab>

to switch to the Makefile in a split window and start

:make

as usual. After compilation, you can hide the Makefile again and continue working.

An alternate way would be to change your make command as James proposed.

Or you could write a macro to change to the directory and run make

:help macro

Cheers,

   Wolfgang
Someone noticed that if I add this line into .vimrc:
autocmd BufEnter * :cd %:p:h

I'll be able to run :make and vim will automatically look at the directory
where currently opened file is located for Makefile.

But if I have directory structure like this:

[d]ProjectDir
  main.cpp
  Makefile
  [dir]SrcDir1
         file1.cpp
  [dir]SrcDir2
         file2.cpp

this command do not work. Makefile is located in root ProjectDir and if I
open for example file1.cpp from SrcDir1, vim can't locate Makefile and I
HAVE TO SWITCH TO ANOTHER BUFFER which contains some source from
ProjectDir in order to compile program...

Is there any opportunity to solve this situation. I have to recompile
project very often while debug sessions, and there is really huge dir
hierarchy...

Reply via email to