Draw Centered from Sublime Text


So sublime text has this great feature that will center your text in the middle of the screen, and the width of the text box will expand as the length of the lines get longer. It looks like this.

Is there any way to replicate this in atom? I feel like there should be a way to do it in the stylesheet at least. Any help is appreciated.


Well, there’s typewriter and Zen.

Both take the preferred line length (80 characters by default) to set the width, so they don’t expand to fit the lines. That should be possible, I never thought of that.

What package/setting is that in Sublime?


Thanks for the reply.

The setting is here. http://www.sublimetext.com/docs/file-type-preferences

I’ve tried your typewriter plugin and Zen, and I like them both, but I did they do not expand from the middle-out. They might be good enough replacements for now until I figure out how to get it working.

Incidentally I havent found any other text editors that have this feature built in.

EDIT: Sublime Text 3 also apparently has the distraction free mode with draw_centered as default. http://www.sublimetext.com/docs/3/distraction_free.html


Ah, I haven’t seen that before. Mostly deal with code where lines tend to get really long, so that wouldn’t do much either :smile:

Anyway, it should be possible, but I doubt the experience in Atom would be very nice. You basically need to rebuild the entire layout every time the buffer changes. Also, I believe not all lines of a document may even be in the DOM at all times. I’d think the performance hit of something like this could be quite severe.


I see. So i guess it’s not quite as simple as figuring out how to do it in CSS and then just plugging it in?


Well, you could do it that way … I’m pretty sure that’s how @braver’s typewriter package started.


Yeah sure, you can do that. It’s really just a website in many ways. What I meant to say is that the tech underneath might not be graceful about the layout changes. But there’s only one way to find out: try and hack it in!


For anyone still looking for Sublime Text’s draw centered setting, I just created https://atom.io/packages/draw-centered


Thank you! Just switching from SublimeText and this is the one thing I was looking for.