ddpd
ddpd

Reputation: 603

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.

Each of them are in different folders and are having different Makefiles.

Is it possible to execute make command in both the buffers for their respective files?

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.

How should I modify to execute make command of xyz.c?

Upvotes: 1

Views: 87

Answers (1)

David Wolever
David Wolever

Reputation: 154484

One way to do this is to :set autochdir (or one one of the other options: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) so that :make will run in the same directory as the source file.

Upvotes: 2

Related Questions