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

formatoptions q (comments) and 2 (2nd line) bad together...?

Expand Messages
  • Tor Perkins
    Greetings all, ... ... and given this text: NOTE: blah blah blah blah # NOTE: blah blah # blah blah If I do gq{motion} on the top paragraph, formatting
    Message 1 of 6 , Jun 1, 2012
    • 0 Attachment
      Greetings all,

      Given these settings:

      :set tw=20
      :set comments=b:#
      :set formatoptions=tcq2
      :set smartindent

      ... and given this text:

      NOTE: blah blah
      blah blah

      # NOTE: blah blah
      # blah blah

      If I do gq{motion} on the top paragraph, formatting is unchanged (as
      expected), however, gq{motion} (or gwap) on the bottom paragraph
      results in this new formatting:

      # NOTE: blah blah
      # blah blah

      So, even though I have both the 2 and q formatoptions, the second
      line's indentation seems to be ignored when within a comment block.
      I would prefer if it could be honored in this case as well. Is that
      possible...?

      Interestingly, the t and c formatoptions (for auto-wrap) are working
      properly with formatoptions+=2 in both paragraphs...

      Thanks for your consideration.

      - Tor

      PS - I'm running Vim 7.2.445 on Debian Linux, but I see the same
      behaviour in Vim 7.3.154 on OpenBSD...

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Tony Mechelynck
      ... There have been quite a number of fixes to indenting code since 7.3.154, see http://ftp.vim.org/pub/vim/patches/7.3/README You might try to install the
      Message 2 of 6 , Jun 1, 2012
      • 0 Attachment
        On 01/06/12 20:25, Tor Perkins wrote:
        >
        > Greetings all,
        >
        > Given these settings:
        >
        > :set tw=20
        > :set comments=b:#
        > :set formatoptions=tcq2
        > :set smartindent
        >
        > ... and given this text:
        >
        > NOTE: blah blah
        > blah blah
        >
        > # NOTE: blah blah
        > # blah blah
        >
        > If I do gq{motion} on the top paragraph, formatting is unchanged (as
        > expected), however, gq{motion} (or gwap) on the bottom paragraph
        > results in this new formatting:
        >
        > # NOTE: blah blah
        > # blah blah
        >
        > So, even though I have both the 2 and q formatoptions, the second
        > line's indentation seems to be ignored when within a comment block.
        > I would prefer if it could be honored in this case as well. Is that
        > possible...?
        >
        > Interestingly, the t and c formatoptions (for auto-wrap) are working
        > properly with formatoptions+=2 in both paragraphs...
        >
        > Thanks for your consideration.
        >
        > - Tor
        >
        > PS - I'm running Vim 7.2.445 on Debian Linux, but I see the same
        > behaviour in Vim 7.3.154 on OpenBSD...
        >


        There have been quite a number of fixes to indenting code since 7.3.154,
        see http://ftp.vim.org/pub/vim/patches/7.3/README

        You might try to install the latest Vim (7.3.538) and see if you still
        have the problem.

        See:
        http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
        http://users.skynet.be/antoine.mechelynck/vim/compunix.htm

        N.B. There exists an apt-get command to get all the dependency packages
        necessary to compile gvim, but I don't know it since I'm on a Linux
        distro (openSUSE) which uses a different kind of package management. I
        recommend running this apt-get command after getting the Vim sources
        with Mercurial (to someplace where they won't be disturbed, as explained
        in the links above) but before running configure.


        Best regards,
        Tony.
        --
        "How do I love thee? My accumulator overflows."

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Tor Perkins
        ... Thanks for your helpful reply! The apt command for pulling Vim s build dependencies is: apt-get build-dep vim Using a virtual system to avoid affecting my
        Message 3 of 6 , Jun 4, 2012
        • 0 Attachment
          On Sat, Jun 02, 2012 at 05:40:39AM +0200, Tony Mechelynck wrote:
          > On 01/06/12 20:25, Tor Perkins wrote:
          > >
          > > Greetings all,
          > >
          > > Given these settings:
          > >
          > > :set tw=20
          > > :set comments=b:#
          > > :set formatoptions=tcq2
          > > :set smartindent
          > >
          > > ... and given this text:
          > >
          > > NOTE: blah blah
          > > blah blah
          > >
          > > # NOTE: blah blah
          > > # blah blah
          > >
          > > If I do gq{motion} on the top paragraph, formatting is unchanged (as
          > > expected), however, gq{motion} (or gwap) on the bottom paragraph
          > > results in this new formatting:
          > >
          > > # NOTE: blah blah
          > > # blah blah
          > >
          > > So, even though I have both the 2 and q formatoptions, the second
          > > line's indentation seems to be ignored when within a comment block.
          > > I would prefer if it could be honored in this case as well. Is that
          > > possible...?
          > >
          > > Interestingly, the t and c formatoptions (for auto-wrap) are working
          > > properly with formatoptions+=2 in both paragraphs...
          > >
          > > Thanks for your consideration.
          > >
          > > - Tor
          > >
          > > PS - I'm running Vim 7.2.445 on Debian Linux, but I see the same
          > > behavior in Vim 7.3.154 on OpenBSD...
          > >
          >
          >
          > There have been quite a number of fixes to indenting code since 7.3.154,
          > see http://ftp.vim.org/pub/vim/patches/7.3/README
          >
          > You might try to install the latest Vim (7.3.538) and see if you still
          > have the problem.
          >
          > See:
          > http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial
          > http://users.skynet.be/antoine.mechelynck/vim/compunix.htm
          >
          > N.B. There exists an apt-get command to get all the dependency packages
          > necessary to compile gvim, but I don't know it since I'm on a Linux
          > distro (openSUSE) which uses a different kind of package management. I
          > recommend running this apt-get command after getting the Vim sources
          > with Mercurial (to someplace where they won't be disturbed, as explained
          > in the links above) but before running configure.
          >
          >
          > Best regards,
          > Tony.
          > --
          > "How do I love thee? My accumulator overflows."
          >
          > --
          > You received this message from the "vim_use" maillist.
          > Do not top-post! Type your reply below the text you are replying to.
          > For more information, visit http://www.vim.org/maillist.php


          Thanks for your helpful reply!

          The apt command for pulling Vim's build dependencies is:

          apt-get build-dep vim

          Using a virtual system to avoid affecting my daily environment, I
          downloaded the source for version 7.3.538 as described in the link you
          provided. I then compiled, installed and ran the new Vim successfully.

          Unfortunately, I still experienced the problem.

          I'm working on a patch. I assume it is best to post that to vim-dev?

          Thanks again!

          - Tor

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Ben Fritz
          ... I ran into this problem some time ago: https://groups.google.com/d/topic/vim_use/hjoM4IdPgMY/discussion I gave up on that line of attack for the problem
          Message 4 of 6 , Jun 4, 2012
          • 0 Attachment
            On Friday, June 1, 2012 1:25:03 PM UTC-5, Tor Perkins wrote:
            > Greetings all,
            >
            > Given these settings:
            >
            > :set tw=20
            > :set comments=b:#
            > :set formatoptions=tcq2
            > :set smartindent
            >
            > ... and given this text:
            >
            > NOTE: blah blah
            > blah blah
            >
            > # NOTE: blah blah
            > # blah blah
            >
            > If I do gq{motion} on the top paragraph, formatting is unchanged (as
            > expected), however, gq{motion} (or gwap) on the bottom paragraph
            > results in this new formatting:
            >
            > # NOTE: blah blah
            > # blah blah
            >
            > So, even though I have both the 2 and q formatoptions, the second
            > line's indentation seems to be ignored when within a comment block.
            > I would prefer if it could be honored in this case as well. Is that
            > possible...?
            >
            > Interestingly, the t and c formatoptions (for auto-wrap) are working
            > properly with formatoptions+=2 in both paragraphs...
            >

            I ran into this problem some time ago:
            https://groups.google.com/d/topic/vim_use/hjoM4IdPgMY/discussion

            I gave up on that line of attack for the problem and eventually wrote my own formatexpr. It doesn't correctly reformat a short first line to include text from the second line but it works fairly well aside from that. I don't remember if I ever tried the plugin recommended in that thread ( http://www.vim.org/scripts/script.php?script_id=1939 ), you might want to look into that, unless you can quickly get your patch working as you want.

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Tor Perkins
            ... Thanks for your reply. I did get my patch working as I want... :^) Anyone interested in my patch can review it here: Subject: Patch: fo=q (comments) w/ n
            Message 5 of 6 , Jun 6, 2012
            • 0 Attachment
              On Mon, Jun 04, 2012 at 12:15:55PM -0700, Ben Fritz wrote:
              > On Friday, June 1, 2012 1:25:03 PM UTC-5, Tor Perkins wrote:
              > > Greetings all,
              > >
              > > Given these settings:
              > >
              > > :set tw=20
              > > :set comments=b:#
              > > :set formatoptions=tcq2
              > > :set smartindent
              > >
              > > ... and given this text:
              > >
              > > NOTE: blah blah
              > > blah blah
              > >
              > > # NOTE: blah blah
              > > # blah blah
              > >
              > > If I do gq{motion} on the top paragraph, formatting is unchanged (as
              > > expected), however, gq{motion} (or gwap) on the bottom paragraph
              > > results in this new formatting:
              > >
              > > # NOTE: blah blah
              > > # blah blah
              > >
              > > So, even though I have both the 2 and q formatoptions, the second
              > > line's indentation seems to be ignored when within a comment block.
              > > I would prefer if it could be honored in this case as well. Is that
              > > possible...?
              > >
              > > Interestingly, the t and c formatoptions (for auto-wrap) are working
              > > properly with formatoptions+=2 in both paragraphs...
              > >
              >
              > I ran into this problem some time ago:
              >
              > https://groups.google.com/d/topic/vim_use/hjoM4IdPgMY/discussion
              >
              > I gave up on that line of attack for the problem and eventually
              > wrote my own formatexpr. It doesn't correctly reformat a short first
              > line to include text from the second line but it works fairly well
              > aside from that. I don't remember if I ever tried the plugin
              > recommended in that thread
              > (http://www.vim.org/scripts/script.php?script_id=1939), you might
              > want to look into that, unless you can quickly get your patch
              > working as you want.

              Thanks for your reply. I did get my patch working as I want... :^)

              Anyone interested in my patch can review it here:

              Subject: Patch: fo=q (comments) w/ n (num list) or 2 (2nd line) indent

              http://groups.google.com/group/vim_dev/browse_thread/thread/72e109959b6794fc

              If you click on "More options-->Show original", you can view the
              message with a fixed space font, which I prefer...

              Thanks!

              - Tor

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Tor Perkins
              ... Just a quick follow-up... Bram has accepted this as Patch 7.3.552 ... Thanks Bram! - Tor -- You received this message from the vim_use maillist. Do not
              Message 6 of 6 , Jun 14, 2012
              • 0 Attachment
                On Wed, Jun 06, 2012 at 07:35:21AM -0700, Tor Perkins wrote:
                > On Mon, Jun 04, 2012 at 12:15:55PM -0700, Ben Fritz wrote:
                > > On Friday, June 1, 2012 1:25:03 PM UTC-5, Tor Perkins wrote:
                > > > Greetings all,
                > > >
                > > > Given these settings:
                > > >
                > > > :set tw=20
                > > > :set comments=b:#
                > > > :set formatoptions=tcq2
                > > > :set smartindent
                > > >
                > > > ... and given this text:
                > > >
                > > > NOTE: blah blah
                > > > blah blah
                > > >
                > > > # NOTE: blah blah
                > > > # blah blah
                > > >
                > > > If I do gq{motion} on the top paragraph, formatting is unchanged (as
                > > > expected), however, gq{motion} (or gwap) on the bottom paragraph
                > > > results in this new formatting:
                > > >
                > > > # NOTE: blah blah
                > > > # blah blah
                > > >
                > > > So, even though I have both the 2 and q formatoptions, the second
                > > > line's indentation seems to be ignored when within a comment block.
                > > > I would prefer if it could be honored in this case as well. Is that
                > > > possible...?
                > > >
                > > > Interestingly, the t and c formatoptions (for auto-wrap) are working
                > > > properly with formatoptions+=2 in both paragraphs...
                > > >
                > >
                > > I ran into this problem some time ago:
                > >
                > > https://groups.google.com/d/topic/vim_use/hjoM4IdPgMY/discussion
                > >
                > > I gave up on that line of attack for the problem and eventually
                > > wrote my own formatexpr. It doesn't correctly reformat a short first
                > > line to include text from the second line but it works fairly well
                > > aside from that. I don't remember if I ever tried the plugin
                > > recommended in that thread
                > > (http://www.vim.org/scripts/script.php?script_id=1939), you might
                > > want to look into that, unless you can quickly get your patch
                > > working as you want.
                >
                > Thanks for your reply. I did get my patch working as I want... :^)
                >
                > Anyone interested in my patch can review it here:
                >
                > Subject: Patch: fo=q (comments) w/ n (num list) or 2 (2nd line) indent
                >
                > http://groups.google.com/group/vim_dev/browse_thread/thread/72e109959b6794fc
                >
                > If you click on "More options-->Show original", you can view the
                > message with a fixed space font, which I prefer...
                >
                > Thanks!
                >
                > - Tor

                Just a quick follow-up...

                Bram has accepted this as "Patch 7.3.552"... Thanks Bram!

                - Tor

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              Your message has been successfully submitted and would be delivered to recipients shortly.