views:

281

answers:

2

I would like to auto-fill a paragraph to 80 characters (or some other fixed width) in Eclipse. Is this possible via a keyboard command like in Emacs? Or is there maybe a plugin (I did not find anything on google)?

Edit: I am not sure if this is relevant, but I need this for docstrings in Python code (using the PyDev plugin).

+2  A: 

Highlight the text, then press Ctrl-Shift-F, or open the context menu and select Source / Format.

Jon Skeet
Unfortunately this doesn't work in my case (Python project with PyDev in Eclipse 3.4.2). Maybe it's because of PyDev?
nikow
Could be. I suspect it's context sensitive... I've always used it in Java. I'll keep this answer here, at least for the moment, for the sake of posterity...
Jon Skeet
Yes, the answer should stay. At least I now know that this might be due to a shortcoming of PyDev.
nikow
Note that unlike the sophisticated command Emacs provides, this Eclipse command apparently only adds line breaks and never removes them -- it's better than nothing, but it doesn't really save very much work when trying to fix formatting after editing a comment.
Porculus
@Porculus: Hmm... it works fine in Java, adding or removing line breaks as required with no problems. What context are you talking about?
Jon Skeet
+2  A: 

You can wrap the paragraph in Pydev with Ctrl+2+w (see Pydev keybindings at: http://pydev.org/manual_adv_keybindings.html)

Fabio Zadrozny
Great, thanks! I don't know how I missed that.
nikow