## Customizing Wrap Paragraph

### Customizing Wrap Paragraph

Is it possible to customize which characters are used as word separators for the "Wrap Paragraph" command? I'm editing Latex files, and I often use labels such as sec:my-section and chap:my-chapter. The problem is that Wrap Paragraph treats colons as valid word separators, so Wrap Paragraph will often convert:

Code: Select all
some long line~\ref{chap:my-chapter}

into

Code: Select all
some long line~\ref{chap:my-chapter}

which breaks the reference. I saw the other threads about not letting the wrapping happen around hyphens, but there does not seem to be an equivalent option for colons. I thought the "word_separators" option would control this, but it does not appear to.
jholewinski

Posts: 4
Joined: Wed Oct 19, 2011 11:32 am

### Re: Customizing Wrap Paragraph

Any workarounds for this? This makes Wrap Paragraph practically useless for Latex editing...
jholewinski

Posts: 4
Joined: Wed Oct 19, 2011 11:32 am

### Re: Customizing Wrap Paragraph

The built-in Wrap Paragraph command doesn't treat colons in any special way, and the only reason it would be breaking on one is if the word is longer than the line width. In that case, if it does break at the colon, it's just coincidence that it happened to become the last character on the line.

To change this, if you are applying the hack from this post, just add

Code: Select all
wrapper.break_long_words = False

to the function as well. But I wouldn't really recommend that, as your edit will get wiped out any time Sublime gets updated.

The best solution is probably to use the Wrap Plus plugin.
It's default behaviour is ALSO to break on hyphens and long words, but it exposes a preference that lets you turn that off. Specifically, add

Code: Select all
"WrapPlus.break_long_words": false,"WrapPlus.break_on_hyphens": false

to your user preferences (or as a syntax-specific preference for LaTeX) to get the appropriate behaviour for LaTeX.
Westacular

Posts: 2
Joined: Fri Dec 07, 2012 5:09 am