Aznaveh
Aznaveh

Reputation: 578

How to treat a Makefile with another name in vim?

I am working in a library that has its own Makefile, so I am using my own Makefile called my_makefile and use make -f my_makefile

My problem is how to tell Vim that my_makefile is an actual Makefile and use color scheme that it use for a Makefile.

It is hard to read it now.

Upvotes: 4

Views: 2561

Answers (3)

Aznaveh
Aznaveh

Reputation: 578

I also have found another way! You can use "my_makefile.mk" and vim automatically know it is a MakeFile and you do not need to change .vimrc either.

Upvotes: 0

Herb
Herb

Reputation: 650

You could also use Modelines, which are comments in either the first 5 or last 5 lines of a file that vim reads, and are used to set the filetype. For example, in a makefile, it would be:

# vim: filetype=make

Upvotes: 5

Adracus
Adracus

Reputation: 1009

How about the

:set syntax=make

command

Upvotes: 8

Related Questions