What I am trying to do seems a very basic stuff, but I can\'t find anything about it. I am working on a project built as usual:
project
|-- bin
|-- inc
`-- s
The solution of rampion is a first step, but computed on vim load. When I load a multi tab session, the path can be inconsistent from one tab to another.
Here my solution (+ extra with tabnew).
fun! SetMkfile()
let filemk = "Makefile"
let pathmk = "./"
let depth = 1
while depth < 4
if filereadable(pathmk . filemk)
return pathmk
endif
let depth += 1
let pathmk = "../" . pathmk
endwhile
return "."
endf
command! -nargs=* Make tabnew | let $mkpath = SetMkfile() | make -C $mkpath | cwindow 10