Add built-in support for "modelines"


#1

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.

https://developer.gnome.org/anjuta-manual/stable/language-support-cpp-modelines-emacs.html.en
http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables

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.


#2

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


#3

Closing this topic as duplicate of the original here:


#4