Loading ...
Sorry, an error occurred while loading the content.
 

Indentation of comments

Expand Messages
  • Carter N.
    Hi all, For Pascal files, I am trying to have three-part comments aligned in the same way as C comments, thus: (* * Pascal comment *) So I run the command set
    Message 1 of 3 , Aug 9, 2004
      Hi all,

      For Pascal files, I am trying to have three-part comments aligned in the
      same way as C comments, thus:

      (*
      * Pascal comment
      *)

      So I run the command

      set comments=s1:(*,mb:*,ex:*)

      (That's es-one, not es-el)

      However, this fails to add a space before the midddle *, so I get

      (*
      * Pascal comment
      *)

      How do I get the middle * aligned the way I want?

      As an aside, I tried sr, but this seemed to give exactly the same result as
      es-one.

      Any suggestions?

      Neil
      --------------------------------------------
      Neil Carter Psychology Department
      IT Technician University of Wales Swansea
      Wales, United Kingdom

      http://psy.swansea.ac.uk/staff/Carter/
    • Michael Geddes
      This works for me. echo has( comments ) maybe try: set formatoptions+=rq //.ichael G ... From: Carter N. [mailto:N.Carter@swansea.ac.uk] Sent: Tuesday, 10
      Message 2 of 3 , Aug 9, 2004
        This works for me.
        echo has('comments')

        maybe try:
        set formatoptions+=rq

        //.ichael G

        -----Original Message-----
        From: Carter N. [mailto:N.Carter@...]
        Sent: Tuesday, 10 August 2004 1:46 AM
        To: 'vim@...'
        Subject: Indentation of comments

        Hi all,

        For Pascal files, I am trying to have three-part comments aligned in the
        same way as C comments, thus:

        (*
        * Pascal comment
        *)

        So I run the command

        set comments=s1:(*,mb:*,ex:*)

        (That's es-one, not es-el)

        However, this fails to add a space before the midddle *, so I get

        (*
        * Pascal comment
        *)

        How do I get the middle * aligned the way I want?

        As an aside, I tried sr, but this seemed to give exactly the same result
        as
        es-one.

        Any suggestions?

        Neil
        --------------------------------------------
        Neil Carter Psychology Department
        IT Technician University of Wales Swansea
        Wales, United Kingdom

        http://psy.swansea.ac.uk/staff/Carter/
      • Carter N.
        Hi all, A while back, I wrote that my indent script for Pascal files didn t indent the middle of three part comments properly. (* * Pascal comment Resulted in
        Message 3 of 3 , Nov 23, 2004
          Hi all,

          A while back, I wrote that my indent script for Pascal files didn't indent
          the middle of three part comments properly.

          (*
          * Pascal comment

          Resulted in

          (*
          * Pascal comment

          This was because my indent script was overriding Vim's built-in indentation
          behaviour. I had 'comments' and 'formatoptions' set correctly. I've now
          fixed this by returning the indent value already calculated by Vim for the
          line. However, this doesn't work for bulleted lists. In this case, it
          indents thus:

          (*
          * Pascal comment
          *
          * - This is a bulleted comment, where comment
          * leaders are not indented properly.

          I can adjust the indentation of the "*" leader easily, but how do I also
          indent the actual comment text relative to the leader?

          Neil
          --------------------------------------------
          Neil Carter Psychology Department
          IT Technician University of Wales Swansea
          Wales, United Kingdom

          http://psy.swansea.ac.uk/staff/Carter/
        Your message has been successfully submitted and would be delivered to recipients shortly.