💾 Archived View for pwshnotes.flounder.online › gemlog › 2022-08-24-asterisk-bullet-points.gmi captured on 2024-08-31 at 12:01:41. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Using Asterisks as Bullet Points in Vim

If I create a bulleted list in Vim using the Markdown or Gemtext syntax:

   * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vulputate erat sit amet leo euismod consectetur. Aliquam ac quam laoreet, euismod lorem non, pellentesque nibh. Fusce id tortor non ipsum dapibus lacinia. 
   * Fusce at enim gravida augue rutrum maximus ut at libero. Suspendisse dignissim tortor nec sem iaculis, auctor consectetur eros facilisis. Morbi varius, dolor sit amet sagittis fringilla, elit purus luctus erat, ac commodo libero neque vel nisl. Quisque porta, diam laoreet hendrerit accumsan, ligula erat placerat augue, luctus ultricies neque nisi a purus. In diam nibh, consectetur mattis nulla vel, tincidunt euismod quam. Nam mattis mi nec turpis convallis vehicula. Aenean non eros ac lorem ullamcorper lobortis. Praesent ligula mauris, volutpat pellentesque maximus in, ullamcorper non tortor.

and format it with the gq command then the list is always prefaced with a bullet (asterisk) on each line:

   * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vulputate
   * erat sit amet leo euismod consectetur. Aliquam ac quam laoreet, euismod
   * lorem non, pellentesque nibh. Fusce id tortor non ipsum dapibus lacinia.
   * Fusce at enim gravida augue rutrum maximus ut at libero. Suspendisse
   * dignissim tortor nec sem iaculis, auctor consectetur eros facilisis. Morbi
   * varius, dolor sit amet sagittis fringilla, elit purus luctus erat, ac
   * commodo libero neque vel nisl. Quisque porta, diam laoreet hendrerit
   * accumsan, ligula erat placerat augue, luctus ultricies neque nisi a purus.
   * In diam nibh, consectetur mattis nulla vel, tincidunt euismod quam. Nam
   * mattis mi nec turpis convallis vehicula. Aenean non eros ac lorem
   * ullamcorper lobortis. Praesent ligula mauris, volutpat pellentesque
   * maximus in, ullamcorper non tortor.

Why is that?

Vim Comments

Vim recognizes the asterisks that I typed as comments for the C programming language:

        /* 
         * This is a test 
         * of the text formatting. 
         */ 

When I reformat the text, Vim helps by automatically formatting the text in the style of C comments.

In part, comments are controlled by the 'comments' option.

comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-

My Comments Option

I use > for quoted text and # for PowerShell comments. Along with * for bullet points, the following option appears to give the desired results.

Some Microsoft documentation uses - for bullets.

JavaScript uses // for comments.

I added the following to my ~/.vim/vimrc file:

set comments=b:#,n:>,fb:-,fb:*,://

Here is the result after restarting Vim:

   * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vulputate
     erat sit amet leo euismod consectetur. Aliquam ac quam laoreet, euismod
     lorem non, pellentesque nibh. Fusce id tortor non ipsum dapibus lacinia.
   * Fusce at enim gravida augue rutrum maximus ut at libero. Suspendisse
     dignissim tortor nec sem iaculis, auctor consectetur eros facilisis. Morbi
     varius, dolor sit amet sagittis fringilla, elit purus luctus erat, ac
     commodo libero neque vel nisl. Quisque porta, diam laoreet hendrerit
     accumsan, ligula erat placerat augue, luctus ultricies neque nisi a purus.
     In diam nibh, consectetur mattis nulla vel, tincidunt euismod quam. Nam
     mattis mi nec turpis convallis vehicula. Aenean non eros ac lorem
     ullamcorper lobortis. Praesent ligula mauris, volutpat pellentesque
     maximus in, ullamcorper non tortor.

References

Introduction to Comments | Vim Help

Comment Reference | Vim Help

Created: Wednesday, August 24, 2022

Updated: Friday, October 7, 2022