Question

I have a target in my Makefile that is as follows:

vim: .vim .vimrc .gvimrc
    $(foreach df, $^, ln -s $(CURDIR)/$(df) ~; )

I also have modelines enabled in vim. This means whenever I open the file in vim I get the following error:

Error detected while processing modelines:
line    5:
E518: Unknown option: .vim
E518: Unknown option: .vim

This is because vim is interpreting the make target as a modeline. Is there a way to get vim to not interpret this target as a modeline?

Was it helpful?

Solution

By default modelines are only read in the top five lines or bottom five lines of the file. If you can rearrange your Makefile this would probably be the best solution.

If this is not an option you can change do add the following to your vimrc.

autocmd FileType make set modelines=0

To turn modelines off. If you change 0 to a different number, this will change the number of lines that are checked at the top and bottom of the files.

Lastly you can just change the target name since it seems to be arbitrary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top