I need to specify file type in the content (embedded in a comment perhaps)


#1

I sometimes get a file downloaded and launched using a local editing application, but the file extension either gets mangled, or converted to .txt (added to the end).

In VIM they had a way to deal with this, which was to look for a certain pattern in the file that could override some settings:

// vim: set ft=yacc:

Is there a way I can do this in Atom? The server I’m using insists on downloading my: code.y file as code.y.txt and then Atom does not want to load it using the correct file type.

I checked into this briefly, and I did not see a way for Atom to distinguish “.y.txt” as a different file type than “.txt”.

(Not just with .y files… also .xml.txt and .js.txt happens often)

Any comments/help to do this better? Manually switching file types is a pain…


#2

You can use the file-types package to open files with the .y.txt extension with the correct grammar


#3

Thanks, this can partly work.

But in some cases my filename still gets mangled to 1hj34gc9c4ncd.tmp

And it would have been helpful to have a content-embedded override.


#4

Hmm, too bad. I don’t know if there’s a package for that yet


#5

Maybe the file-mode package does what you need?


#6

That’s it! Thanks! .