abrookins / WrapToColumn

An IntelliJ plugin that wraps text
Apache License 2.0
62 stars 12 forks source link

Select and wrap multiple paragraphs? #33

Open jduan opened 4 years ago

jduan commented 4 years ago

First of all, thanks for making such a great plugin to fill the gaps!

A common need of mine is to select multiple paragraphs and wrap them. For example, when you copy a large body of text from somewhere and use them as comment. Is there a way to wrap multiple paragraphs? Thanks!

abrookins commented 3 years ago

Interesting. Good point. I'll think about this!

cmeeren commented 3 years ago

I would like this, too. Specifically, I'd like the ability to run the tool for all paragraphs in the comment/"section" I'm in, and to run the tool for an entire file. (Maybe even also a whole solution.)

abrookins commented 3 years ago

I experimented with this today after remembering that I had used the plugin to wrap multiple lines before. Try the Wrap Line to Column action. The default keyboard shortcut on Mac is Command + Control + Shift + W, but check the README for others. You can also select text and access the Intellij Command Palette, then type "Wrap" and select Wrap Line to Column.

This action is maybe not well-named -- it actually wraps all selected lines or the current line if none is selected. Give that a shot.

I just tested this with a Markdown file and a large comment block in Python, and it wrapped multiple lines decently.

cmeeren commented 3 years ago

Thanks. That's better, though a feature to wrap all lines in the current comment (no selection needed) would be better. Also, you can't use this for whole files (with code in between the comments).

abrookins commented 3 years ago

Ah, yeah, I see what you mean. So the missing features are:

  1. Wrap all lines in current comment without needing selection
  2. Wrap all comments in the current file

Something like that?

cmeeren commented 3 years ago

Exactly. Or even better than the second one: wrap all comments in the current selection. Then it's easy to "select all" and do the entire file, but I could also select just part of the file, so it's more flexible.