简体   繁体   English

从vim编辑器为不同文件执行make命令

[英]To execute make command for different files from vim editor

I have two different independent files opened in vim editor with buffers b1 pointing to abc.c and b2 pointing to xyz.c . 我在vim编辑器中打开了两个不同的独立文件,其中缓冲区b1指向abc.cb2指向xyz.c

Each of them are in different folders and are having different Makefiles. 它们每个都位于不同的文件夹中,并且具有不同的Makefile。

Is it possible to execute make command in both the buffers for their respective files? 是否可以在两个缓冲区中为它们各自的文件执行make命令?

Currently If I open abc.c from its respective folder, then I can only execute make command for that file ( abc.c ).If the same command is executed in b2 ( xyz.c ),makefile for abc.c is getting compiled. 当前,如果我从其各自的文件夹中打开abc.c ,则只能执行该文件( abc.c )的make命令。如果在b2xyz.c )中执行了相同的命令,则正在编译abc.c makefile 。

How should I modify to execute make command of xyz.c ? 我应该如何修改以执行xyz.c make命令?

一种方法是:set autochdir (或其他选项之一: http :set autochdir ),以便:make将在与源文件相同的目录中运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM