Default format when opening a new file



I’m new to Atom but now I’ve been searching for quite a time for a rather simple feature and it seems it isn’t implemented or I’m to dumb to find it.
How can I set the default format so every time I open a new file it set’s it automatically to my configured format type so I can start coding right away without first needing to specify the format in the down right of the editor?

It seems like a basic feature I can’t find in Atom? Other IDEs all seem to have such a setting, why doesn’t Atom?


If you save a new file, Atom will automatically set the grammar based on the file extension. If you want all new files to have a specific grammar set, you can manage it with an tweak that I can show you how to do.


Thanks for your answer. I’d like the format to be automatically set when you open a new file without the need to safe it first. If you know a way I’d be grateful if you tell me.


Put the following in your

atom.workspace.observeTextEditors (editor) ->
  if not editor.getPath()

Set language syntax per project or folder? (Atom on Windows)

There’s also a FAQ for this:


Thank you a lot! I hadn’t found the FAQ even though I searched on Google for quite some time for a solution. Now with the code from the FAQ it works perfectly.

Just in case somebody finds this useful:
I wanted to make python the default format and this code in the works for me. Make sure to properly indent the lines.

   atom.workspace.observeTextEditors (editor) ->
    original = editor.getGrammar()
    if original? and original is atom.grammars.grammarForScopeName('text.plain.null-grammar')