[announce] Multi Wrap Guide


#1

Been hacking on this for a while now. I’m newish to the world of Atom development and have been lurking on some discussion threads recently. I feel like this package is finally baked enough for an announce thread.

Basically:

Move 'em

Create 'em

Go nuts


#2

I think this is really interesting… but I’m having a hard time thinking of a use case. Maybe making sure that white-spaced columns actually line up correctly? Anything else?

Also, which wrap guide would something like autoflow (which hard-wraps a selection at your editor preferred line length) use?


#3

For me, personally, I put columns at:

  • 73: git commit messages
  • 80: a very common style guide line length
  • 100: another common style guide line length
  • 120: my preferred line length

And just leave those on all the time, for all languages. But that’s just me. I wanted to make a package that met my needs but was also flexible enough and easy enough to use that anyone could configure guides to their liking without ever having to open up config.cson. The way I imagine people using it is that guides remain locked 99% of the the time, and are only unlocked during initial setup or when they want to change configuration for a particular language.

I’m not sure about the use case for the horizontal guides but a user requested it and I figured, ok why not? :smile:

As for autoflow: I think if you’re hard wrapping lines at a particular length anyway, then you don’t really need any wrap guides enabled. You can toggle off multi-wrap-guide for those cases. That’s just my opinion tho. Maybe others would like to have a, let’s say, 10 character warning before their line would be hard wrapped? A kind of “heads up!” Just an idea.


#4

I’m trying to figure out if this plugin will match my use case…

I work for a few companies that want lines broken at 80 chars, but I find this horrible to look at in the Atom editor, so I’d like to have something longer whilst I’m working (I am a technical writer, in case you wonder why I want long lines).

Could I use this plugin to have a longer wrap when I’m writing, but an 80 char break also set and then use https://atom.io/packages/line-length-break to make the line breaks when I’m done to create line breaks at the 80 char line.

Does that make sense at all? it might all be a bit particular to my setup.


#5

You can do that with vanilla Atom. This package would be useful if you wanted more than one wrap guide.


#6

That sounds exactly like something I want multi-wrap-guide to be used for, but it doesn’t currently support it.

Right now multi-wrap-guide uses the longest line length as the editor’s hard wrap length (no text beyond the farthest out wrap guide). This means if you had two wrap guides (one at 80 and one at 100) and then used the line-length-break package, it’d break lines along the furthest out wrap guide (the one at 100).

The way that line-length-break makes perfect sense when you only have one wrap guide, but it’s functionality is limited when there’s more than one. I think the solution here is to offer a way to line break at a selected guide, rather than assuming the farthest out guide.

I think I can get this working. multi-wrap-guide can detect if line-length-break is installed, and offer a new context sensitive right click menu option “Line break at this guide” or whatever, which then runs the line-length-break command on that line. The alternative would be to copy/paste line-length-break's code into multi-wrap-guide (tweaked a bit to support multiple guide) I think the MIT license would allow this, but it feels dirty… I’d much rather solve this through composition if possible.


#7

It may also be confused by my use of the https://atom.io/packages/typewriter plugin, I will figure this out one day and explain exactly what my issue is, I think both plugins use the soft wrap setting so I can get the balance of the two right.

I’ll try to find some time to experiment and see what I come up with.


#8

@ChrisChinchilla give v0.24.0 of multi-wrap-guide a try. I just added a feature to do what you want, provided you have both multi-wrap-guide and line-length-break installed :slight_smile:


#9

Just got that update, will give it a try :slight_smile: