Set default language in Atom to Python

Found this on the Atom Discourse.

Put this in your init file

atom.workspace.observeTextEditors (editor) ->
   unless editor.getPath()
       editor.setGrammar(atom.grammars.grammarForScopeName('source.python'))

Hope this is useful, thought someone asked on a thread, but cannot find it now.

Randy

1 Like

thanks… i saw your post at atom’s forum too…

what’s weird about it is that it’s not setting the file type, just the syntax… or, the new file is still just untitled instead of untitled.py (i.e., the new file still won’t run in rhino unless you save it as python first)…

idk, at first i thought it was a hassle to assign/save a file prior to writing but now that i know atom a little better, it’s not even a big deal anymore :wink:

Hi,

If you have a bunch of scripts in a directory you might want to launch Atom in dev mode. From a terminal window, if your current directory is where you store your scripts then

atom

will launch Atom with all your files in a tree on the left w/o the default “untitled” file. Add one or more files if you want to open them on launch.

atom myscript.py

Or from the menu, View > Developer > Open In Dev Mode.