ehuss / Sublime-Wrap-Plus

Enhanced "wrap lines" command for Sublime Text 2 or 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document WrapPlus.wrap_col_diff

heyimalex opened this issue · comments

I was looking for this feature, planned to write it, and just happened to stumble upon it when going through the source. Noticed it wasn't documented in the readme nor the page on package control. Proposed description in the style of package control page:

Name Default Description
“WrapPlus.wrap_col_diff” 0 Lets you change the size of the wrapped column relative to the discovered size, i.e. with a wrap_width of 78 and WrapPlus.wrap_col_diff of 8, WrapPlus would wrap columns at 78 - 8 or 70.

Kinda wordy though.

Just curious, what do you use it for?

I mostly write python, and only really use hard wraps for comments. From pep8:

Limit all lines to a maximum of 79 characters.

For flowing long blocks of text with fewer structural restrictions (docstrings or comments), the line length should be limited to 72 characters.

But mostly I just think it looks better.

It's not clear to me why you wouldn't just set wrap_width to 72. However, I have added WrapPlus.include_line_endings and WrapPlus.wrap_width so hopefully that will cover your needs.

WrapPlus.wrap_width looks like it handles it, thanks!

It's not clear to me why you wouldn't just set wrap_width to 72

Just to clarify; I have lines of code that are longer than 72 characters but below 80 and I don't want those to visually soft wrap, but when I Alt+Q hard wrap my comments I want them at 72 chars. As an example:

raw un-wrapped text

def example():
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris adipiscing viverra mauris quis pulvinar.
    """
    return some_really_long_function(kwarg1='foo', kwarg2='bar', kwarg3='baz')

wrap_width @ 80, hard wrapped comment is too long.

def example():
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris adipiscing
    viverra mauris quis pulvinar.
    """
    return some_really_long_function(kwarg1='foo', kwarg2='bar', kwarg3='baz')

wrap_width @ 72, sublimetext softwraps the code to look like this

def example():
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris
    adipiscing viverra mauris quis pulvinar.
    """
    return some_really_long_function(kwarg1='foo', kwarg2='bar', kwarg3
        ='baz')