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

stale help about window-local options

Expand Messages
  • Kartik Agaram
    A coworker pointed out that part of the window-local example in :help local-options is no longer accurate. ... Now the list option will also be set in
    Message 1 of 3 , Apr 25, 2013
    • 0 Attachment
      A coworker pointed out that part of the window-local example in ":help local-options" is no longer accurate.

              :e one
              :set list
              :e two
      Now the 'list' option will also be set in "two", since with the ":set list"
      command you have also set the global value. >
              :set nolist
              :e one
              :setlocal list
              :e two
      Now the 'list' option is not set, because ":set nolist" resets the global
      value, ":setlocal list" only changes the local value and ":e two" gets the
      global value.

      So far so good, but now:

      Note that if you do this next: >

              :e one
      You will not get back the 'list' value as it was the last time you edited
      "one".  The options local to a window are not remembered for each buffer.

      This seems no longer to be true; the previous buffer does indeed seem to remember its 'list' setting. Did the behavior change at some point?

      The existing behavior seems superior, so here's a patch to delete that last note and bring the docs in sync.

      --
      --
      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
       
      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • Bram Moolenaar
      ... Instead of deleting the text, let s correct it. And add useful information about when the options are kept. Please check if this actually works this way
      Message 2 of 3 , Apr 27, 2013
      • 0 Attachment
        Kartik Agaram wrote:

        > A coworker pointed out that part of the window-local example in ":help
        > local-options" is no longer accurate.
        >
        > :e one
        > :set list
        > :e two
        > Now the 'list' option will also be set in "two", since with the ":set list"
        > command you have also set the global value. >
        > :set nolist
        > :e one
        > :setlocal list
        > :e two
        > Now the 'list' option is not set, because ":set nolist" resets the global
        > value, ":setlocal list" only changes the local value and ":e two" gets the
        > global value.
        >
        > So far so good, but now:
        >
        > Note that if you do this next: >
        > :e one
        > You will not get back the 'list' value as it was the last time you edited
        > "one". The options local to a window are not remembered for each buffer.
        >
        > This seems no longer to be true; the previous buffer does indeed seem to
        > remember its 'list' setting. Did the behavior change at some point?
        >
        > The existing behavior seems superior, so here's a patch to delete that last
        > note and bring the docs in sync.

        Instead of deleting the text, let's correct it. And add useful
        information about when the options are kept. Please check if this
        actually works this way (I'm too lazy :-).


        Now the 'list' option is not set, because ":set nolist" resets the global
        value, ":setlocal list" only changes the local value and ":e two" gets the
        global value. Note that if you do this next: >
        :e one
        You will get back the 'list' value as it was the last time you edited "one".
        The options local to a window are remembered for each buffer. This also
        happens when the buffer is not loaded, but they are lost when the buffer is
        wiped out |:bwipe|.


        --
        hundred-and-one symptoms of being an internet addict:
        240. You think Webster's Dictionary is a directory of WEB sites.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Kartik Agaram
        Sorry about the delay. ... Yes, this is accurate in my testing. Did you mean This also happens when the buffer is unloaded |:bunload|, but local options are
        Message 3 of 3 , May 10, 2013
        • 0 Attachment
          Sorry about the delay.

          > Now the 'list' option is not set, because ":set nolist" resets the global
          > value, ":setlocal list" only changes the local value and ":e two" gets the
          > global value. Note that if you do this next: >
          > :e one
          > You will get back the 'list' value as it was the last time you edited "one".
          > The options local to a window are remembered for each buffer. This also
          > happens when the buffer is not loaded, but they are lost when the buffer is
          > wiped out |:bwipe|.

          Yes, this is accurate in my testing. Did you mean "This also happens
          when the buffer is unloaded |:bunload|, but local options are lost.."?
          That's what I tried.

          > Instead of deleting the text, let's correct it. And add useful
          > information about when the options are kept.

          The basic example with ':e one' didn't seem to me to require an
          example because the entire two previous paragraphs basically say the
          same thing. Buffer-local variables should be persisted within the
          buffer, duh :) But the points about :bunload and :bwipe are useful.

          ---

          I've been working off and on on rephrasing that entire paragraph, but
          I think I don't fully understand it yet :)

          It's possible to set a local window option specifically for a type of
          buffer. When you edit another buffer in the same window, you don't want to
          keep using these local window options. Therefore Vim keeps a global value
          of the local window options, which is used when editing another buffer.
          Each window has its own copy of these values. Thus these are local to the
          window, but global to all buffers in the window.

          What does "a type of buffer" mean? It's unclear how the first sentence
          connects up with the rest.

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.