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

Re: Feature Request: A special value for softtabstop that makes it equal to tabstop

Expand Messages
  • Milan Vancura
    Hi Bram. ... Yes, this is what I do for years: sw and sts set to the same value (and to try to not forget to change the second when changing the first). It
    Message 1 of 16 , Oct 3, 2012
      Hi Bram.

      > It might make more sense to have a negative 'sts' value mean that
      > 'shiftwidth' is used.

      Yes, this is what I do for years: sw and sts set to the same value (and to try
      to not forget to change the second when changing the first). It would be a
      pretty enhancement if sts followed sw value automatically.

      Milan Vančura

      --
      You received this message from the "vim_dev" 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
    • So8res
      Works like a charm, Christian. Bram, I d love to have a negative sts mean that it s the same as sw. The reason I suggested a zero value is for consistency, in
      Message 2 of 16 , Oct 3, 2012
        Works like a charm, Christian.

        Bram, I'd love to have a negative sts mean that it's the same as sw. The reason I suggested a zero value is for consistency, in that setting sw=0 means use the sts value. I'd recommend allowing sw to be negative if we go ahead with this.

        Attached is Christian's diff modified so that sts falls back to sw instead of ts.




        On Wednesday, October 3, 2012 6:53:30 AM UTC-7, Milan Vancura wrote:
        > Hi Bram.
        >
        >
        >
        > > It might make more sense to have a negative 'sts' value mean that
        >
        > > 'shiftwidth' is used.
        >
        >
        >
        > Yes, this is what I do for years: sw and sts set to the same value (and to try
        >
        > to not forget to change the second when changing the first). It would be a
        >
        > pretty enhancement if sts followed sw value automatically.
        >
        >
        >
        > Milan Van�ura

        --
        You received this message from the "vim_dev" 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
      • So8res
        Typo: setting sw=0 means use the tabstop value. True consistency would have this change accompanied by one which has sw=0 turns sw off and sw=-1 uses the ts
        Message 3 of 16 , Oct 3, 2012
          Typo: setting sw=0 means use the tabstop value. True consistency would have this change accompanied by one which has sw=0 'turns sw off' and sw=-1 'uses the ts value'. (Though I can't imagine what turning sw off means aside from using the tabstop value, so I think it would be fine to just allow sw to be negative.)

          Below is a patch which allows such behavior.

          On Wednesday, October 3, 2012 3:29:08 PM UTC-7, So8res wrote:
          > Works like a charm, Christian.
          >
          >
          >
          > Bram, I'd love to have a negative sts mean that it's the same as sw. The reason I suggested a zero value is for consistency, in that setting sw=0 means use the sts value. I'd recommend allowing sw to be negative if we go ahead with this.
          >
          >
          >
          > Attached is Christian's diff modified so that sts falls back to sw instead of ts.
          >
          >
          >
          >
          >
          >
          >
          >
          >
          > On Wednesday, October 3, 2012 6:53:30 AM UTC-7, Milan Vancura wrote:
          >
          > > Hi Bram.
          >
          > >
          >
          > >
          >
          > >
          >
          > > > It might make more sense to have a negative 'sts' value mean that
          >
          > >
          >
          > > > 'shiftwidth' is used.
          >
          > >
          >
          > >
          >
          > >
          >
          > > Yes, this is what I do for years: sw and sts set to the same value (and to try
          >
          > >
          >
          > > to not forget to change the second when changing the first). It would be a
          >
          > >
          >
          > > pretty enhancement if sts followed sw value automatically.
          >
          > >
          >
          > >
          >
          > >
          >
          > > Milan Van�ura

          --
          You received this message from the "vim_dev" 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
        • So8res
          The above patch has a typo! Oops. I d love to see this feature go in when the sw=0 indent fixes go in, because then we can just set ts=8 sw=0 sts=-1 and use
          Message 4 of 16 , Oct 16, 2012
            The above patch has a typo! Oops. I'd love to see this feature go in when the sw=0 indent fixes go in, because then we can just "set ts=8 sw=0 sts=-1" and use tabstop alone to adjust indent width. The second patch (corrected below) makes it so sw can also be negative (which means it falls back to tabstop) just for consistency with sts. I'm not sure if it's the right thing to do but it might be.

            --
            You received this message from the "vim_dev" 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
          • Andy Wokula
            ... Er, again, what s the deal with sts=-1 ? It s not needed. So is sw=-1 (not needed, for consistency). -- Andy -- You received this message from the
            Message 5 of 16 , Oct 16, 2012
              Am 17.10.2012 00:17, schrieb So8res:
              > The above patch has a typo! Oops. I'd love to see this feature go in
              > when the sw=0 indent fixes go in, because then we can just "set ts=8
              > sw=0 sts=-1" and use tabstop alone to adjust indent width. The second
              > patch (corrected below) makes it so sw can also be negative (which
              > means it falls back to tabstop) just for consistency with sts. I'm not
              > sure if it's the right thing to do but it might be.

              Er, again, what's the deal with sts=-1 ?
              It's not needed.
              So is sw=-1 (not needed, for consistency).

              --
              Andy

              --
              You received this message from the "vim_dev" 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
            • So8res
              ... sts=-1 would mean that sts takes on the same value as the shiftwidth. This means you can change your shiftwidth and have the softtabstop change
              Message 6 of 16 , Oct 16, 2012
                > Er, again, what's the deal with sts=-1 ?

                sts=-1 would mean that sts takes on the same value as the shiftwidth.

                This means you can change your shiftwidth and have the softtabstop change automatically. I (and I imagine most users with sts on) want the softtabstop to be one shiftwidth wide, but I often forget to update it.

                The most common use case is deleting multiple spaces at a time. Imagine &sw=4 and &sts=4 and you have a file with 'expand' tab. You 'set sw=8'. Now when your cursor is sitting behind 16 spaces and you hit backspace you expect 8 spaces to be deleted, but only 4 are deleted because you forgot to update 'sts'. This is incredibly annoying.

                > So is sw=-1 (not needed, for consistency).

                sw=0 has a similar effect to sts=-1, i.e. sw=0 makes sw take on the same value as tabstop. It's a bit strange to have one start falling back on the '-1' value and the other on the '0' value, which is why I put the second patch up; it makes sw behave a little more consistently with sts. I'm not sure it's a good idea, but it's something to think about.

                By the way, this version fixes a documentation error in the above patch:

                --
                You received this message from the "vim_dev" 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
              • Andy Wokula
                ... There is another option, what about ts=8 sts=4 sw=0 with effective shiftwidth = 4? I think shiftwidth has a stronger connection to softtabstop than to
                Message 7 of 16 , Oct 16, 2012
                  Am 17.10.2012 00:53, schrieb So8res:
                  >> Er, again, what's the deal with sts=-1 ?
                  >
                  > sts=-1 would mean that sts takes on the same value as the shiftwidth.
                  >
                  > This means you can change your shiftwidth and have the softtabstop
                  > change automatically. I (and I imagine most users with sts on) want
                  > the softtabstop to be one shiftwidth wide, but I often forget to
                  > update it.
                  >
                  > The most common use case is deleting multiple spaces at a time.
                  > Imagine &sw=4 and &sts=4 and you have a file with 'expand' tab. You
                  > 'set sw=8'. Now when your cursor is sitting behind 16 spaces and you
                  > hit backspace you expect 8 spaces to be deleted, but only 4 are
                  > deleted because you forgot to update 'sts'. This is incredibly
                  > annoying.
                  >
                  >> So is sw=-1 (not needed, for consistency).
                  >
                  > sw=0 has a similar effect to sts=-1, i.e. sw=0 makes sw take on the
                  > same value as tabstop. It's a bit strange to have one start falling
                  > back on the '-1' value and the other on the '0' value, which is why I
                  > put the second patch up; it makes sw behave a little more consistently
                  > with sts. I'm not sure it's a good idea, but it's something to think
                  > about.

                  There is another option, what about
                  ts=8
                  sts=4
                  sw=0
                  with effective shiftwidth = 4? I think 'shiftwidth' has a stronger
                  connection to 'softtabstop' than to 'tabstop' ... Is it useful to get
                  an effective shiftwidth of 8 in this case?

                  If not then negative values for sw / sts should be avoided.

                  But you have to change 'softtabstop' instead of 'shiftwidth'.

                  --
                  Andy

                  --
                  You received this message from the "vim_dev" 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
                • So8res
                  That s certainly a possibility, though then I d want sts=-1 to make sts fall back to the tabstop value or we still have the problem of setting the same
                  Message 8 of 16 , Oct 16, 2012
                    That's certainly a possibility, though then I'd want "sts=-1" to make "sts" fall back to the "tabstop" value or we still have the problem of setting the same thing in two places. The original patch actually had sts falling back to tabstop, but Bram thought it was better to have sts fall back to shiftwidth.

                    On Tuesday, October 16, 2012 4:12:26 PM UTC-7, Andy Wokula wrote:
                    > Am 17.10.2012 00:53, schrieb So8res:
                    >
                    > >> Er, again, what's the deal with sts=-1 ?
                    >
                    > >
                    >
                    > > sts=-1 would mean that sts takes on the same value as the shiftwidth.
                    >
                    > >
                    >
                    > > This means you can change your shiftwidth and have the softtabstop
                    >
                    > > change automatically. I (and I imagine most users with sts on) want
                    >
                    > > the softtabstop to be one shiftwidth wide, but I often forget to
                    >
                    > > update it.
                    >
                    > >
                    >
                    > > The most common use case is deleting multiple spaces at a time.
                    >
                    > > Imagine &sw=4 and &sts=4 and you have a file with 'expand' tab. You
                    >
                    > > 'set sw=8'. Now when your cursor is sitting behind 16 spaces and you
                    >
                    > > hit backspace you expect 8 spaces to be deleted, but only 4 are
                    >
                    > > deleted because you forgot to update 'sts'. This is incredibly
                    >
                    > > annoying.
                    >
                    > >
                    >
                    > >> So is sw=-1 (not needed, for consistency).
                    >
                    > >
                    >
                    > > sw=0 has a similar effect to sts=-1, i.e. sw=0 makes sw take on the
                    >
                    > > same value as tabstop. It's a bit strange to have one start falling
                    >
                    > > back on the '-1' value and the other on the '0' value, which is why I
                    >
                    > > put the second patch up; it makes sw behave a little more consistently
                    >
                    > > with sts. I'm not sure it's a good idea, but it's something to think
                    >
                    > > about.
                    >
                    >
                    >
                    > There is another option, what about
                    >
                    > ts=8
                    >
                    > sts=4
                    >
                    > sw=0
                    >
                    > with effective shiftwidth = 4? I think 'shiftwidth' has a stronger
                    >
                    > connection to 'softtabstop' than to 'tabstop' ... Is it useful to get
                    >
                    > an effective shiftwidth of 8 in this case?
                    >
                    >
                    >
                    > If not then negative values for sw / sts should be avoided.
                    >
                    >
                    >
                    > But you have to change 'softtabstop' instead of 'shiftwidth'.
                    >
                    >
                    >
                    > --
                    >
                    > Andy

                    --
                    You received this message from the "vim_dev" 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
                  • Gary Johnson
                    I know we want to avoid option bloat, but I really hate special values, especially ones as non-obvious as these. How about instead a new boolean option,
                    Message 9 of 16 , Oct 16, 2012
                      I know we want to avoid option bloat, but I really hate "special"
                      values, especially ones as non-obvious as these.

                      How about instead a new boolean option, 'tabbind'? When off,
                      'shiftwidth', 'tabstop' and 'softtabstop' are all independent. When
                      on, all those values are set to that of the last one set.

                      For example, if 'tabbind' is on when the user sets 'tabstop', both
                      'shiftwidth' and 'softtabstop' are also set to the new value of
                      'tabstop'. The user doesn't have to remember what "-1" means or
                      which option needs to be set last to affect the others.

                      Regards,
                      Gary

                      --
                      You received this message from the "vim_dev" 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 think having too many options is better than having too few with special overloaded behaviors. That is just my preference though. ... I like this idea
                      Message 10 of 16 , Oct 16, 2012
                        On Tuesday, October 16, 2012 7:04:49 PM UTC-5, Gary Johnson wrote:
                        > I know we want to avoid option bloat, but I really hate "special"
                        > values, especially ones as non-obvious as these.
                        >
                        > How about instead a new boolean option, 'tabbind'? When off,
                        > 'shiftwidth', 'tabstop' and 'softtabstop' are all independent. When
                        > on, all those values are set to that of the last one set.
                        >

                        I think having too many options is better than having too few with special overloaded behaviors. That is just my preference though.

                        > For example, if 'tabbind' is on when the user sets 'tabstop', both
                        > 'shiftwidth' and 'softtabstop' are also set to the new value of
                        > 'tabstop'. The user doesn't have to remember what "-1" means or
                        > which option needs to be set last to affect the others.
                        >

                        I like this idea very much.

                        --
                        You received this message from the "vim_dev" 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
                      • Christian Brabandt
                        ... I tend to not agree. I don t like having yet another option plus once we have this option, someone wants this to be local to buffer or someone want to have
                        Message 11 of 16 , Oct 17, 2012
                          On Wed, October 17, 2012 02:04, Gary Johnson wrote:
                          > I know we want to avoid option bloat, but I really hate "special"
                          > values, especially ones as non-obvious as these.
                          >
                          > How about instead a new boolean option, 'tabbind'? When off,
                          > 'shiftwidth', 'tabstop' and 'softtabstop' are all independent. When
                          > on, all those values are set to that of the last one set.
                          >
                          > For example, if 'tabbind' is on when the user sets 'tabstop', both
                          > 'shiftwidth' and 'softtabstop' are also set to the new value of
                          > 'tabstop'. The user doesn't have to remember what "-1" means or
                          > which option needs to be set last to affect the others.

                          I tend to not agree. I don't like having yet another option plus once
                          we have this option, someone wants this to be local to buffer or someone
                          want to have 'sw' follow 'ts' but not 'sts'.

                          I think it is easier, if we just document the special behaviour of
                          using 0 or -1 or whatever value we agree about.

                          Users that care to customize, can read about the special values in the
                          documentation, which they have to do anyhow. If they don't care, they use
                          whatever their disro or filetype plugin provides and then it is no
                          problem, that the values are not obvious.

                          regards,
                          Christian

                          --
                          You received this message from the "vim_dev" 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
                        • Andy Wokula
                          ... sts=0 and spaces/tabs in the indent part are inserted according to shiftwidth . -- Andy -- You received this message from the vim_dev maillist. Do not
                          Message 12 of 16 , Oct 17, 2012
                            Am 03.10.2012 15:53, schrieb Milan Vancura:
                            > Hi Bram.
                            >
                            >> It might make more sense to have a negative 'sts' value mean that
                            >> 'shiftwidth' is used.
                            >
                            > Yes, this is what I do for years: sw and sts set to the same value (and to try
                            > to not forget to change the second when changing the first). It would be a
                            > pretty enhancement if sts followed sw value automatically.
                            >
                            > Milan Vančura

                            This *is* supported:

                            :h 'smarttab
                            :set ts& sts& sw=4 sta

                            sts=0 and spaces/tabs in the indent part are inserted according to 'shiftwidth'.

                            --
                            Andy

                            --
                            You received this message from the "vim_dev" 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
                          • Andy Wokula
                            ... Now you can change tabstop via softtabstop ... great, this is even more black magic (just next to gdefault , remap , magic , edcompatible , etc.)
                            Message 13 of 16 , Oct 17, 2012
                              Am 17.10.2012 02:28, schrieb Ben Fritz:
                              > On Tuesday, October 16, 2012 7:04:49 PM UTC-5, Gary Johnson wrote:
                              >> I know we want to avoid option bloat, but I really hate "special"
                              >> values, especially ones as non-obvious as these.
                              >>
                              >> How about instead a new boolean option, 'tabbind'? When off,
                              >> 'shiftwidth', 'tabstop' and 'softtabstop' are all independent. When
                              >> on, all those values are set to that of the last one set.
                              >
                              > I think having too many options is better than having too few with
                              > special overloaded behaviors. That is just my preference though.

                              Now you can change 'tabstop' via 'softtabstop' ... great, this is even
                              more black magic (just next to 'gdefault', 'remap', 'magic',
                              'edcompatible', etc.)

                              >> For example, if 'tabbind' is on when the user sets 'tabstop', both
                              >> 'shiftwidth' and 'softtabstop' are also set to the new value of
                              >> 'tabstop'. The user doesn't have to remember what "-1" means or
                              >> which option needs to be set last to affect the others.

                              With good luck, a value of -1 is not needed.

                              > I like this idea very much.

                              The user still cannot have ts=8 and sts+sw bound together
                              (without the 'smarttab' side effects).

                              --
                              Andy

                              --
                              You received this message from the "vim_dev" 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.