It is inconsiderate to place editor settings inside code files?
Posted
by
Carlos Campderrós
on Programmers
See other posts from Programmers
or by Carlos Campderrós
Published on 2012-09-07T08:04:00Z
Indexed on
2012/09/07
9:49 UTC
Read the original article
Hit count: 228
I know this is kind of a subjective question, but I'm curious if there's any good reason to place (or not place) editor settings inside code files. I'm thinking in vi
modelines, but it is possible that this applies to other editors.
In short, a vi
modeline is a line inside a file that tells vi
how to behave (indent with spaces or tabs, set tabwidth to X, autoindent by default or not, ...) that is placed inside a comment, so it won't affect the program/compiler when running. In a .c
file it could be similar to
// vim: noai:ts=4:sw=4
On one hand, I think this shouldn't be inside the file, as it is an editor setting and so belongs to an editor configuration file or property. On the other hand, for projects involving developers outside one company (that are not imposed an editor/settings) or collaborators on github/bitbucket/... it is an easy way to avoid breaking the code style (tabs vs spaces for example), but only for the ones that use that editor though.
I cannot see any powerful enough reason to decide for or against this practice, so I am in doubt of what to do.
© Programmers or respective owner