PEP8 and the Atom editor
I tried out the Atom text editor very soon after it came out. For some reason--whether a half-hearted attempt on my part, or the fact that Atom was an unrefined beta--I didn't love it. After only a day or two, I reverted to the Komodo Edit editor I had been comfortable with for several years.
Recently, I heard a colleague describe Atom as a "Markdown editor". I was surprised, since my impression is that Atom was developed as a general purpose editor. But after my colleague showed me Atom's real-time Markdown render/preview feature, I figured I might give Atom a try again.
I'm enjoying Atom much better this time around. After working with it for a few days doing some basic programming (Python) and writing (Markdown) I had no complaints. It was only when I started revisiting some of my C code that I started having problems.
Not serious problems by any means: maybe annoyances is a better word. Anyway, I follow PEP8 for the most part when I write Python code, so I had my wrap guide set to 79 characters. This became awkward when I am working on C code, where I have long used 80 characters as the limit. I was not enthusiastic about switching the wrap guide every time I changed langauges, which seemed to be the only alternative to just switching the whole thing off.
Since Atom is touted as the ultimate hackable and configurable editor, I figured I would see if the wrap guide is something I can configure on a per-language basis.
Surely enough, a bit of Google searching uncovered the secret.
The preferredLineLength
attribute under editor
controls where the wrap guide is displayed.
I set the default (under *
) to 80, and then I created another Python-specific configuration with ".source.py"
, with preferredLineLength
set to 79.
Here is my Atom configuration file, stored at ~/.atom/config.cson
.
"*":
core:
disabledPackages: [
"spell-check"
]
projectHome: "/Users/standage/Software"
editor:
fontFamily: "Consolas"
invisibles: {}
preferredLineLength: 80
showIndentGuide: true
tabLength: 4
welcome:
showOnStartup: false
".source.py":
"editor:":
preferredLineLength: 79
That's it!