Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would recommend putting the following into your vimrc if this is a regular issue:</p> <pre><code>nnoremap &lt;leader&gt;f gqip </code></pre> <p>This maps the leader f shortcut (f is for "format") to format the comment (considered a paragraph after setting some formatoption flags) with gq which formats the comment to be the width of the currently set <code>textwidth</code> or <code>tw</code> option. You should set textwidth in your .vimrc with <code>textwidth=80</code>.</p> <p>Formatoptions is the other thing you should fiddle with, specifically in your case by adding the <code>acq</code> flags with <code>formatoptions+=acq</code>. Be careful to remove the <code>t</code> flag with <code>formatoptions-=t</code> because that will automatically wrap all of your code, not just recognized comments. After doing all this you should be able to hit f and format inside only the comment, irrespective of whether is is surrounded by blank lines.</p> <p>Here is the relevant info on formatoptions so you can make your own choices.</p> <pre><code>t Auto-wrap text using textwidth c Auto-wrap comments using textwidth, inserting the current comment leader automatically. r Automatically insert the current comment leader after hitting &lt;Enter&gt; in Insert mode. o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode. q Allow formatting of comments with "gq". Note that formatting will not change blank lines or lines containing only the comment leader. A new paragraph starts after such a line, or when the comment leader changes. w Trailing white space indicates a paragraph continues in the next line. A line that ends in a non-white character ends a paragraph. a Automatic formatting of paragraphs. Every time text is inserted or deleted the paragraph will be reformatted. See |auto-format|. When the 'c' flag is present this only happens for recognized comments. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload