New files inherit file type of currently open file


Hello. Atom is very cool. Switched from TextMate2, does everything I need. One thing that is a bit cumbersome though. Currently all new files are set as plain text. One thing that would be neat is, when hitting Cmd+N to create a new file, if it could apply the same file type as the file I’m looking at, that would help a lot.

e.g. if I’m editing a ruby file, then hit Cmd+N, it should create a new file with file type of ruby.



The easiest way would be to use advanced-open-file to create a new file with the .rb extension.

If you don’t want to have to name the new file to get the grammar, then you might have to override the new file command to record the grammar of the active TextBuffer, create a blank TextBuffer, and set the grammar in the newly created buffer to the grammar of the previous one. That’s doable via the API.