Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#84 'gq' in visual mode to reformat comment blocks

closed-out-of-date
nobody
None
5
2012-01-27
2011-08-18
Luka Fürst
No

In ViM, the 'gq' combination (without quotes) can be used in visual mode to reformat comment blocks automatically.

Example:

/** This comment is very long. It contains much more than 80 characters, so it should be displayed in several lines of approximately the same length.
* In ViM, you can
* achieve that simply by selecting the entire comment and pressing `gq' (without quotes, of course). */

After selecting the entire comment and pressing gq:

/** This comment is very long. It contains much more than 80 characters, so
* it should be displayed in several lines of approximately the same length.
* In ViM, you can achieve that simply by selecting the entire comment and
* pressing `gq' (without quotes, of course). */

Discussion

  • Ernie Rael
    Ernie Rael
    2011-08-18

    Formatting and indenting are handled by the platform; jVi hooks into them. You can vote for the NetBeans bug

    Bug 11553 - [indentation/formating] javadoc comments should be justifiable

    and encourage people to vote for it.

    Once it is in NetBeans it will either just work or I'll fix it.

     
  • Ernie Rael
    Ernie Rael
    2011-12-04

    • status: open --> open-out-of-date
     
  • Ernie Rael
    Ernie Rael
    2011-12-04

    In NB 7.1 this works.

     
  • Ernie Rael
    Ernie Rael
    2011-12-04

    Well, most works. I just filed the NB bug:

    [Bug 205907] New: Comment formatting puts characters past right margin

     
  • Ernie Rael
    Ernie Rael
    2012-01-27

    • status: open-out-of-date --> closed-out-of-date