如何有效地“制造"产品.与Vim [英] How to efficiently "make" with Vim
问题描述
我正在尝试做的事情似乎是非常基本的东西,但是我找不到任何东西.我正在像往常一样建立一个项目:
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
`-- src
我想使用Vim中包含的make命令来创建我的项目.但是每次我必须指定:make -C ../
.我希望,如果当前目录中没有Makefile文件,请进入父目录.我已经使用
I would like to make my project using the make command included in Vim. But each time I have to specify :make -C ../
. I would prefer, if there is not Makefile file in the current directory, go in the parent directory. I already do that with
set tags+=./tags;/
在我的.vimrc
中.
此外,默认情况下,make很难看.是否有添加颜色的选项,并允许直接访问错误(如Emacs中一样).
Furthermore, the make is by default ugly. Are there options to add color to make, and allow a direct access to the errors (as in Emacs).
谢谢
推荐答案
倾斜的解决方案是第一步,但要根据vim负载进行计算.当我加载多标签会话时,从一个标签到另一个标签的路径可能不一致.
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.
这是我的解决方案(带有tabnew的其他内容).
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 <args> -C $mkpath | cwindow 10
这篇关于如何有效地“制造"产品.与Vim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!