Add built-in support for "modelines"


Both Vim and Emacs have a feature most commonly referred to as modelines. The basic idea is that it provides you the ability to store information about how to parse a file within a comment. A very common use case is when you are using a custom file extension for a certain file type, like .conf for YAML. Let’s say you are always going to parse that file as YAML, then the extension or file meta is no matter. The only thing that is important is to maintain the proper syntax highlighting and whitespace requirements.

Emacs modelines are loosely defined, but pretty common in use. GitHub supports the use of -*- mode: yaml -*- to apply yaml syntax highlighting. Some open source projects use modelines in more advanced ways, but things start to vary at that point. The mode property is the most common one to find in use. There are some active examples of setting tabs and other whitespace properties as well.

Vim requires the use of vim in the comment, so that could rule it out. There are likely plugins to use the Emacs variations as well. On the other hand vim modelines have a pretty well established format and commonly used shorthand.

I think there is a lot of room to build upon the Emacs variation. I also think there is a lot to learn from the vim method. Supporting both would certainly have advantages in enabling people to use Atom in diverse teams. Either way the built in GitHub support seems like a great starting point.


A post was merged into an existing topic: Support for vim and emacs file variables


Closing this topic as duplicate of the original here: