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

Re: History and "set history=xx"

Expand Messages
  • Meino Christian Cramer
    From: Benji Fisher Subject: Re: History and set history=xx Date: Sun, 30 Apr 2006 12:02:11 -0400 ... Hi, yes, it is documented
    Message 1 of 18 , Apr 30, 2006
    • 0 Attachment
      From: Benji Fisher <benji@...>
      Subject: Re: History and "set history=xx"
      Date: Sun, 30 Apr 2006 12:02:11 -0400

      > On Sun, Apr 30, 2006 at 05:38:34PM +0200, Meino Christian Cramer wrote:
      > > result:
      > >
      > > set nocompatible
      > >
      > > sets
      > >
      > > set history=20
      > >
      > > .
      > >
      > > Why this is implemented that way and why one has to debug step
      > > through his .vimrc to find out isn't obvious to me. And I fear,
      > > I am not the only one...
      >
      > I did not think about that. It is explained under
      >
      > :help 'compatible'
      >
      > where (among other things) you can find the warning
      >
      > This is a special kind of option, because when it's set or reset,
      > other options are also changed as a side effect. CAREFUL: Setting or
      > resetting this option can have a lot of unexpected effects: Mappings
      > are interpreted in another way, undo behaves differently, etc. If you
      > set this option in your vimrc file, you should probably put it at the
      > very start.
      >
      > Bram:
      >
      > Would it be possible for vim to add a note, something like
      >
      > Last set from ~/.vimrc along with 'nocompatible'
      >
      > in response to
      >
      > :verbose set history?
      >
      > in this case?
      >
      > HTH --Benji Fisher
      >

      Hi,

      yes, it is documented somewhere....

      The problem arises from another side: If a newbie like me is stepping
      through his .vimrc in search of the cause of his
      "history"-problems... would it be obvious or logical to do a

      help compatible

      to solve problems in setting history to a certain value ?

      I am sure that all features of vim are well documented. The thing is:
      Will I find the needed information ? And will I know/guess the right
      keyword for this task?

      "helpgrep" is such a thing. It matches *everything* which mention a
      certain word.

      Suppose I would have still the problem with "set history" and did
      a "helgrep history" therefore ... I would have gotten

      twohundredandfive (205)

      matches. And *NO* match would give me the correct information.


      The learning curve is steep with vim. Ok, no problem. I successfully
      learned other complicated things.But if it is just tidous to find
      what I am trying to learn....

      Dont misunderstand me here, vim folks. I still like vim. But I have
      my doubts, that the help "system" is useful for /learning/. It is
      more useful to re-remember things which one has already known and
      forgot it just in a certain moment.

      keep hacking!
      mcc
    • Bram Moolenaar
      ... There is a remark about this right at :help history . ... Adding more info when :verbose is used is getting complicated. Perhaps the line number could
      Message 2 of 18 , Apr 30, 2006
      • 0 Attachment
        Benji Fisher wrote:

        > On Sun, Apr 30, 2006 at 05:38:34PM +0200, Meino Christian Cramer wrote:
        > > result:
        > >
        > > set nocompatible
        > >
        > > sets
        > >
        > > set history=20
        > >
        > > .
        > >
        > > Why this is implemented that way and why one has to debug step
        > > through his .vimrc to find out isn't obvious to me. And I fear,
        > > I am not the only one...
        >
        > I did not think about that. It is explained under
        >
        > :help 'compatible'
        >
        > where (among other things) you can find the warning
        >
        > This is a special kind of option, because when it's set or reset,
        > other options are also changed as a side effect. CAREFUL: Setting or
        > resetting this option can have a lot of unexpected effects: Mappings
        > are interpreted in another way, undo behaves differently, etc. If you
        > set this option in your vimrc file, you should probably put it at the
        > very start.

        There is a remark about this right at ":help 'history'".

        > Bram:
        >
        > Would it be possible for vim to add a note, something like
        >
        > Last set from ~/.vimrc along with 'nocompatible'
        >
        > in response to
        >
        > :verbose set history?
        >
        > in this case?

        Adding more info when :verbose is used is getting complicated. Perhaps
        the line number could be added.

        --
        MICHAEL PALIN PLAYED: 1ST SOLDIER WITH A KEEN INTEREST IN BIRDS, DENNIS, MR
        DUCK (A VILLAGE CARPENTER WHO IS ALMOST KEENER THAN
        ANYONE ELSE TO BURN WITCHES), THREE-HEADED KNIGHT, SIR
        GALAHAD, KING OF SWAMP CASTLE, BROTHER MAYNARD'S ROOMATE
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
      • Yakov Lerner
        ... Maybe behaviour of set nocp can be differentiated depending on whether &cp was already off , or &cp was on. It s one thing if you do set nocp and &cp
        Message 3 of 18 , Apr 30, 2006
        • 0 Attachment
          On 4/30/06, Bram Moolenaar <Bram@...> wrote:
          > > :help 'compatible'
          > >
          > > where (among other things) you can find the warning
          > >
          > > This is a special kind of option, because when it's set or reset,
          > > other options are also changed as a side effect. CAREFUL: Setting or
          > > resetting this option can have a lot of unexpected effects: Mappings
          > > are interpreted in another way, undo behaves differently, etc. If you
          > > set this option in your vimrc file, you should probably put it at the
          > > very start.
          >
          > There is a remark about this right at ":help 'history'".

          Maybe behaviour of 'set nocp' can be differentiated depending on
          whether &cp was already off , or &cp was on. It's one thing if
          you do 'set nocp' and &cp was on, and another thing when
          you do 'set nocp' and &cp was already off. Maybe 'set nocp'
          doesn't need to reset options to default values when it was
          already 'nocp'.

          Yakov
        • Gerald Lai
          ... But in Meino s case, it may have been that he was still in Vi compatible mode when he set history. The compatible option is one that clobbers settings,
          Message 4 of 18 , Apr 30, 2006
          • 0 Attachment
            On Sun, 30 Apr 2006, Yakov Lerner wrote:

            > On 4/30/06, Bram Moolenaar <Bram@...> wrote:
            >> > :help 'compatible'
            >> >
            >> > where (among other things) you can find the warning
            >> >
            >> > This is a special kind of option, because when it's set or reset,
            >> > other options are also changed as a side effect. CAREFUL: Setting
            >> or
            >> > resetting this option can have a lot of unexpected effects:
            >> Mappings
            >> > are interpreted in another way, undo behaves differently, etc. If
            >> you
            >> > set this option in your vimrc file, you should probably put it at
            >> the
            >> > very start.
            >>
            >> There is a remark about this right at ":help 'history'".
            >
            > Maybe behaviour of 'set nocp' can be differentiated depending on
            > whether &cp was already off , or &cp was on. It's one thing if
            > you do 'set nocp' and &cp was on, and another thing when
            > you do 'set nocp' and &cp was already off. Maybe 'set nocp'
            > doesn't need to reset options to default values when it was
            > already 'nocp'.

            But in Meino's case, it may have been that he was still in Vi compatible
            mode when he set history.

            The 'compatible' option is one that clobbers settings, but for a good
            reason. It determines whether Vim should work like Vi, or take on the
            modern Vim capabilities. It's a big switch.

            There's a brief mention of 'set compatible' in ":help system-vimrc", but
            it doesn't stress that it should be placed at the very top. Perhaps it
            should. The only mention of this is at ":help 'compatible'". I'm not
            sure if beginners reading starting.txt will notice to check out the
            option help.

            --
            Gerald
          • Yakov Lerner
            ... Meino s commands were in .vimrc which means nocp was already nocp. ... It s only a switch if nocp was off and becomes on. If option X has value Y and I
            Message 5 of 18 , Apr 30, 2006
            • 0 Attachment
              On 4/30/06, Gerald Lai <laige@...> wrote:
              > On Sun, 30 Apr 2006, Yakov Lerner wrote:
              >
              > > On 4/30/06, Bram Moolenaar <Bram@...> wrote:
              > >> > :help 'compatible'
              > >> >
              > >> > where (among other things) you can find the warning
              > >> >
              > >> > This is a special kind of option, because when it's set or reset,
              > >> > other options are also changed as a side effect. CAREFUL: Setting
              > >> or
              > >> > resetting this option can have a lot of unexpected effects:
              > >> Mappings
              > >> > are interpreted in another way, undo behaves differently, etc. If
              > >> you
              > >> > set this option in your vimrc file, you should probably put it at
              > >> the
              > >> > very start.
              > >>
              > >> There is a remark about this right at ":help 'history'".
              > >
              > > Maybe behaviour of 'set nocp' can be differentiated depending on
              > > whether &cp was already off , or &cp was on. It's one thing if
              > > you do 'set nocp' and &cp was on, and another thing when
              > > you do 'set nocp' and &cp was already off. Maybe 'set nocp'
              > > doesn't need to reset options to default values when it was
              > > already 'nocp'.
              >
              > But in Meino's case, it may have been that he was still in Vi compatible
              > mode when he set history.

              Meino's commands were in .vimrc which means nocp was
              already nocp.

              > The 'compatible' option is one that clobbers settings, but for a good
              > reason. It determines whether Vim should work like Vi, or take on the
              > modern Vim capabilities. It's a big switch.

              It's only a switch if 'nocp' was off and becomes on. If option
              X has value Y and I do 'set X=Y' I expect it to be noop, except maybe
              screen refresh. When option had different value, and I change it's
              value, then I agree it's a switch.

              Yakov
            • Gerald Lai
              ... True. ... That would be nice, but how about options like filetype , fileformat or background that need to be refreshed ? Or options like indentkeys
              Message 6 of 18 , Apr 30, 2006
              • 0 Attachment
                On Sun, 30 Apr 2006, Yakov Lerner wrote:

                > On 4/30/06, Gerald Lai <laige@...> wrote:
                >> On Sun, 30 Apr 2006, Yakov Lerner wrote:
                >>
                >> > On 4/30/06, Bram Moolenaar <Bram@...> wrote:
                >> >> > :help 'compatible'
                >> >> >
                >> >> > where (among other things) you can find the warning
                >> >> >
                >> >> > This is a special kind of option, because when it's set or
                >> reset,
                >> >> > other options are also changed as a side effect. CAREFUL:
                >> Setting
                >> >> or
                >> >> > resetting this option can have a lot of unexpected effects:
                >> >> Mappings
                >> >> > are interpreted in another way, undo behaves differently, etc.
                >> If
                >> >> you
                >> >> > set this option in your vimrc file, you should probably put it
                >> at
                >> >> the
                >> >> > very start.
                >> >>
                >> >> There is a remark about this right at ":help 'history'".
                >> >
                >> > Maybe behaviour of 'set nocp' can be differentiated depending on
                >> > whether &cp was already off , or &cp was on. It's one thing if
                >> > you do 'set nocp' and &cp was on, and another thing when
                >> > you do 'set nocp' and &cp was already off. Maybe 'set nocp'
                >> > doesn't need to reset options to default values when it was
                >> > already 'nocp'.
                >>
                >> But in Meino's case, it may have been that he was still in Vi compatible
                >> mode when he set history.
                >
                > Meino's commands were in .vimrc which means nocp was
                > already nocp.
                >

                True.

                >> The 'compatible' option is one that clobbers settings, but for a good
                >> reason. It determines whether Vim should work like Vi, or take on the
                >> modern Vim capabilities. It's a big switch.
                >
                > It's only a switch if 'nocp' was off and becomes on. If option
                > X has value Y and I do 'set X=Y' I expect it to be noop, except maybe
                > screen refresh. When option had different value, and I change it's
                > value, then I agree it's a switch.

                That would be nice, but how about options like 'filetype', 'fileformat'
                or 'background' that need to be "refreshed"? Or options like
                'indentkeys' or 'listchars' that could be an out-of-order
                comma-separated list composed of anything?

                There's too much overhead of checking whether X=Y just to do a noop.

                --
                Gerald
              • Yakov Lerner
                ... Since when it s too much overhead to check the value of binary option for equaliy or not equality ? Yakov
                Message 7 of 18 , Apr 30, 2006
                • 0 Attachment
                  On 4/30/06, Gerald Lai <laige@...> wrote:
                  > On Sun, 30 Apr 2006, Yakov Lerner wrote:
                  >
                  > > On 4/30/06, Gerald Lai <laige@...> wrote:
                  > >> On Sun, 30 Apr 2006, Yakov Lerner wrote:
                  > >>
                  > >> > On 4/30/06, Bram Moolenaar <Bram@...> wrote:
                  > >> >> > :help 'compatible'
                  > >> >> >
                  > >> >> > where (among other things) you can find the warning
                  > >> >> >
                  > >> >> > This is a special kind of option, because when it's set or
                  > >> reset,
                  > >> >> > other options are also changed as a side effect. CAREFUL:
                  > >> Setting
                  > >> >> or
                  > >> >> > resetting this option can have a lot of unexpected effects:
                  > >> >> Mappings
                  > >> >> > are interpreted in another way, undo behaves differently, etc.
                  > >> If
                  > >> >> you
                  > >> >> > set this option in your vimrc file, you should probably put it
                  > >> at
                  > >> >> the
                  > >> >> > very start.
                  > >> >>
                  > >> >> There is a remark about this right at ":help 'history'".
                  > >> >
                  > >> > Maybe behaviour of 'set nocp' can be differentiated depending on
                  > >> > whether &cp was already off , or &cp was on. It's one thing if
                  > >> > you do 'set nocp' and &cp was on, and another thing when
                  > >> > you do 'set nocp' and &cp was already off. Maybe 'set nocp'
                  > >> > doesn't need to reset options to default values when it was
                  > >> > already 'nocp'.
                  > >>
                  > >> But in Meino's case, it may have been that he was still in Vi compatible
                  > >> mode when he set history.
                  > >
                  > > Meino's commands were in .vimrc which means nocp was
                  > > already nocp.
                  > >
                  >
                  > True.
                  >
                  > >> The 'compatible' option is one that clobbers settings, but for a good
                  > >> reason. It determines whether Vim should work like Vi, or take on the
                  > >> modern Vim capabilities. It's a big switch.
                  > >
                  > > It's only a switch if 'nocp' was off and becomes on. If option
                  > > X has value Y and I do 'set X=Y' I expect it to be noop, except maybe
                  > > screen refresh. When option had different value, and I change it's
                  > > value, then I agree it's a switch.
                  >
                  > That would be nice, but how about options like 'filetype', 'fileformat'
                  > or 'background' that need to be "refreshed"? Or options like
                  > 'indentkeys' or 'listchars' that could be an out-of-order
                  > comma-separated list composed of anything?
                  >
                  > There's too much overhead of checking whether X=Y just to do a noop.

                  Since when it's too much overhead to check the
                  value of binary option for equaliy or not equality ?

                  Yakov
                • Gary Johnson
                  ... If setting an option has a side-effect, I generally expect that side-effect to occur whenever I set the option. If an option X has a value Y, and I know
                  Message 8 of 18 , Apr 30, 2006
                  • 0 Attachment
                    On 2006-04-30, Yakov Lerner <iler.ml@...> wrote:
                    > On 4/30/06, Gerald Lai <laige@...> wrote:

                    > > The 'compatible' option is one that clobbers settings, but for a good
                    > > reason. It determines whether Vim should work like Vi, or take on the
                    > > modern Vim capabilities. It's a big switch.
                    >
                    > It's only a switch if 'nocp' was off and becomes on. If option
                    > X has value Y and I do 'set X=Y' I expect it to be noop, except maybe
                    > screen refresh. When option had different value, and I change it's
                    > value, then I agree it's a switch.

                    If setting an option has a side-effect, I generally expect that
                    side-effect to occur whenever I set the option. If an option X has
                    a value Y, and I know this, I have no reason to "set X=Y" unless I
                    want the side-effect to happen. If I don't know the current value
                    of X, I expect "set X=Y" to to behave consistently and not in a
                    manner dependent on its current value. That's following the
                    principle of least surprise.

                    Further, if I don't like that behavior and want "set X=Y" to be a
                    no-op if X already equals Y, I can work around that with something
                    like

                    if X != Y
                    set X=Y
                    endif

                    I can't work around the other behavior without setting X to some
                    value not equal Y, which may have side-effects I want to avoid.

                    Gary

                    --
                    Gary Johnson | Agilent Technologies
                    garyjohn@... | Wireless Division
                    | Spokane, Washington, USA
                  • Benji Fisher
                    ... Yes. ... That would have helped a lot in this case. Save the user from having to do a binary search! HTH --Benji Fisher
                    Message 9 of 18 , Apr 30, 2006
                    • 0 Attachment
                      On Sun, Apr 30, 2006 at 07:03:03PM +0200, Bram Moolenaar wrote:
                      >
                      > Benji Fisher wrote:
                      >
                      > There is a remark about this right at ":help 'history'".

                      Yes.

                      > > Bram:
                      > >
                      > > Would it be possible for vim to add a note, something like
                      > >
                      > > Last set from ~/.vimrc along with 'nocompatible'
                      > >
                      > > in response to
                      > >
                      > > :verbose set history?
                      > >
                      > > in this case?
                      >
                      > Adding more info when :verbose is used is getting complicated. Perhaps
                      > the line number could be added.

                      That would have helped a lot in this case. Save the user from
                      having to do a binary search!

                      HTH --Benji Fisher
                    • Gerald Lai
                      ... [snip] ... Sorry, I meant to say that there s overhead for checking if option X == Y for options that are non-binary, like indentkeys or listchars . For
                      Message 10 of 18 , Apr 30, 2006
                      • 0 Attachment
                        On Sun, 30 Apr 2006, Yakov Lerner wrote:

                        > On 4/30/06, Gerald Lai <laige@...> wrote:
                        >> On Sun, 30 Apr 2006, Yakov Lerner wrote:
                        >>
                        >> > On 4/30/06, Gerald Lai <laige@...> wrote:
                        >> >> On Sun, 30 Apr 2006, Yakov Lerner wrote:
                        >> >>
                        >> >> > On 4/30/06, Bram Moolenaar <Bram@...> wrote:
                        >> >> >> > :help 'compatible'
                        >> >> >> >
                        [snip]
                        >> >> The 'compatible' option is one that clobbers settings, but for a good
                        >> >> reason. It determines whether Vim should work like Vi, or take on the
                        >> >> modern Vim capabilities. It's a big switch.
                        >> >
                        >> > It's only a switch if 'nocp' was off and becomes on. If option
                        >> > X has value Y and I do 'set X=Y' I expect it to be noop, except maybe
                        >> > screen refresh. When option had different value, and I change it's
                        >> > value, then I agree it's a switch.
                        >>
                        >> That would be nice, but how about options like 'filetype', 'fileformat'
                        >> or 'background' that need to be "refreshed"? Or options like
                        >> 'indentkeys' or 'listchars' that could be an out-of-order
                        >> comma-separated list composed of anything?
                        >>
                        >> There's too much overhead of checking whether X=Y just to do a noop.
                        >
                        > Since when it's too much overhead to check the
                        > value of binary option for equaliy or not equality ?

                        Sorry, I meant to say that there's overhead for checking if option X ==
                        Y for options that are non-binary, like 'indentkeys' or 'listchars'.

                        For binary options, your suggestion is plausible, though I do
                        agree with Gary said. Some options have to be refreshed, and it will be
                        inconsistent to have setting binary options do a noop if the option is
                        set to what it already is, while other options maintain the same :set
                        behavior.

                        An exception could be made for 'compatible', but that is an exception
                        Bram would have to make.

                        --
                        Gerald
                      Your message has been successfully submitted and would be delivered to recipients shortly.