Skip to content

Instantly share code, notes, and snippets.

@twolfson
Last active December 20, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twolfson/6191987 to your computer and use it in GitHub Desktop.
Save twolfson/6191987 to your computer and use it in GitHub Desktop.
Notes from playing with optimal line characters in code

I have been thinking about applying more design concepts to code for the bonuses that come with them.

I have already started enforcing with vertical rhythm (see other post) and it feels great.

Today, I decided to play with the optimal amount of characters per line.

// TODO: Tangent while writing, we should try out dynamic word wrap?

The concept is take the typographic design rule of optimal amount of characters per line (65 chars at 16pt font) and apply it to code. My interpretation has been to fork from absolute 80 character limit and move to a relative 65 character limit.

I wrote up a quick Sublime plugin, optimize-lines, which "works" but doesn't highlight past characters which defeats the purpose.

optimal-lines.png

After realizing it was unfeasible to go straight to a proof of concept, I went into pixlr and started playing around:

Highlighted sections:

optimal-highlight.jpg

Variable ruler:

optimal-ruler.jpg

Variable continuous ruler:

optimal-ruler-continuous.jpg

Colored ruler:

optimal-colored-ruler.jpg

Colored continuous ruler:

optimal-colored-ruler-continuous.jpg

I am not in awe of the results and feel there is a better solution but don't know the representation of it yet.

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment