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

:set background=... bug

Expand Messages
  • Christian J. Robinson
    I have created a ~/.vim/after/syntax/syncolor.vim file, which is properly loaded when I do :syntax on , but it appears to be ignored when the value of
    Message 1 of 6 , Jun 30, 2001
      I have created a ~/.vim/after/syntax/syncolor.vim file, which is
      properly loaded when I do ":syntax on", but it appears to be ignored
      when the value of 'background' is changed. This causes the highlights
      I've defined there to be reset when I change the value of
      'background'. A subsequent ":syntax on" reloads the file.

      --
      I can't use Windows. My cat ate my mouse.
      Christian J. Robinson <infynity@...> ICQ: 15869262
      http://www.infynity.mux.cx/ GPG key: hkp://pgpkeys.mit.edu/0x893B0EAF
    • Benji Fisher
      ... Are you saying that changing background by hand is the problem? The docs recommend a :syntax on after you :set background . Or is the problem that you
      Message 2 of 6 , Jun 30, 2001
        "Christian J. Robinson" wrote:
        >
        > I have created a ~/.vim/after/syntax/syncolor.vim file, which is
        > properly loaded when I do ":syntax on", but it appears to be ignored
        > when the value of 'background' is changed. This causes the highlights
        > I've defined there to be reset when I change the value of
        > 'background'. A subsequent ":syntax on" reloads the file.

        Are you saying that changing 'background' by hand is the problem? The
        docs recommend a :syntax on after you :set background . Or is the problem
        that you :set background in your startup files, and have to do :syntax on
        later? I think it is recommended that 'background' be set in your vimrc file,
        and :syntax on be done in your gvimrc file.

        HTH --Benji Fisher
      • Christian J. Robinson
        ... The Vim6 documentation (:help background & :help syncolor) suggests (or at least implies) that setting the background option should re-initialize
        Message 3 of 6 , Jun 30, 2001
          Today, Benji Fisher wrote:

          > "Christian J. Robinson" wrote:
          >
          >> I have created a ~/.vim/after/syntax/syncolor.vim file, which is
          >> properly loaded when I do ":syntax on", but it appears to be
          >> ignored when the value of 'background' is changed. This causes the
          >> highlights I've defined there to be reset when I change the value
          >> of 'background'. A subsequent ":syntax on" reloads the file.
          >
          > Are you saying that changing 'background' by hand is the
          > problem? The docs recommend a :syntax on after you :set background.
          > Or is the problem that you :set background in your startup files,
          > and have to do :syntax on later? I think it is recommended that
          > 'background' be set in your vimrc file, and :syntax on be done in
          > your gvimrc file.

          The Vim6 documentation (:help 'background' & :help syncolor) suggests
          (or at least implies) that setting the background option should
          re-initialize highlighting the same as if you'd done ":syntax on".

          In Vim5, you did have to do an explicit ":syntax on" after changing
          the value of 'background'. However, in Vim6, changing the value of
          'background' does cause Vim6 to re-initialize, but without
          ~/.vim/after/syntax/syncolor.vim

          As to your questions, I set the background in my .vimrc then turn
          syntax on, but I also set the background option in my .gvimrc as well
          (dark for console/xterms, light for the GUI).

          --
          It's hard to make a comeback when you haven't been anywhere.
          Christian J. Robinson <infynity@...> ICQ: 15869262
          http://www.infynity.mux.cx/ GPG key: hkp://pgpkeys.mit.edu/0x893B0EAF
        • Benji Fisher
          ... [snip] ... So default color groups and color schemes are reloaded. But at the end it says ... Can you be more specific about where in the docs it suggests
          Message 4 of 6 , Jun 30, 2001
            "Christian J. Robinson" wrote:
            >
            [snip]
            > The Vim6 documentation (:help 'background' & :help syncolor) suggests
            > (or at least implies) that setting the background option should
            > re-initialize highlighting the same as if you'd done ":syntax on".

            From :help 'background' (in the Vim 6.0j docs):

            > When 'background' is set Vim will adjust the default color groups for
            > the new value. But the colors used for syntax highlighting will not
            > change.
            > When a color scheme is loaded (the "colors_name" variable is set)
            > setting 'background' will cause the color scheme to be reloaded. ...

            So default color groups and color schemes are reloaded. But at the end it
            says

            > This option is also used in the "$VIMRUNTIME/syntax/syntax.vim" file
            > to select the colors for syntax highlighting. After changing this
            > option, you must load syntax.vim again to see the result. This can be
            > done with ":syntax on".

            Can you be more specific about where in the docs it suggests otherwise?

            --Benji Fisher
          • Christian J. Robinson
            ... It s hard for me to understand why would be logical, or useful to have to do :syntax on if changing the value of background automatically resets the
            Message 5 of 6 , Jun 30, 2001
              Today, Benji Fisher wrote:

              > "Christian J. Robinson" wrote:
              >
              > [snip]
              >> The Vim6 documentation (:help 'background' & :help syncolor)
              >> suggests (or at least implies) that setting the background option
              >> should re-initialize highlighting the same as if you'd done
              >> ":syntax on".
              >
              >From :help 'background' (in the Vim 6.0j docs):
              >
              > > When 'background' is set Vim will adjust the default color
              > > groups for the new value. But the colors used for syntax
              > > highlighting will not change.
              > > When a color scheme is loaded (the "colors_name" variable is
              > > set) setting 'background' will cause the color scheme to be
              > > reloaded. ...
              >
              > So default color groups and color schemes are reloaded. But at the
              > end it says
              >
              > > This option is also used in the
              > > "$VIMRUNTIME/syntax/syntax.vim" file to select the colors for
              > > syntax highlighting. After changing this option, you must
              > > load syntax.vim again to see the result. This can be done
              > > with ":syntax on".

              It's hard for me to understand why would be logical, or useful to have
              to do ":syntax on" if changing the value of 'background' automatically
              resets the colors. IMO, it should do it the same way as ":syntax on"
              or ":syntax reset". Isn't this what people would naturally expect to
              happen?

              Perhaps part of the documentation still needs to be updated to reflect
              the change from Vim5?

              > Can you be more specific about where in the docs it suggests
              > otherwise?

              Under ":help syncolor":

              If you want to use different colors for syntax highlighting, you can
              add a Vim script file to set these colors. Put this file in a
              directory in 'runtimepath' which comes after $VIMRUNTIME, so that
              your settings overrule the default colors. This way these colors will
              be used after the ":syntax reset" command.

              ...

              Doing this is how I came across this behavior, which can only describe
              as "unexpected". I would go so far as to say that it has added extra
              overhead. Setting the value of 'background' then doing ":syntax on"
              causes vim to load several files twice.

              --
              I have a really good memory, except it's short.
              Christian J. Robinson <infynity@...> ICQ: 15869262
              http://www.infynity.mux.cx/ GPG key: hkp://pgpkeys.mit.edu/0x893B0EAF
            • Bram Moolenaar
              ... Well, I don t know exactly what the docs say, but it s quite easy to make Vim load all syncolor.vim files, as most people will expect: ... ***************
              Message 6 of 6 , Jun 30, 2001
                "Christian J. Robinson" wrote:

                > The Vim6 documentation (:help 'background' & :help syncolor) suggests
                > (or at least implies) that setting the background option should
                > re-initialize highlighting the same as if you'd done ":syntax on".
                >
                > In Vim5, you did have to do an explicit ":syntax on" after changing
                > the value of 'background'. However, in Vim6, changing the value of
                > 'background' does cause Vim6 to re-initialize, but without
                > ~/.vim/after/syntax/syncolor.vim

                Well, I don't know exactly what the docs say, but it's quite easy to make Vim
                load all syncolor.vim files, as most people will expect:

                *** syntax.c~ Sat Jun 30 16:53:42 2001
                --- syntax.c Sat Jun 30 16:54:38 2001
                ***************
                *** 5863,5869 ****
                * If syntax highlighting is enabled load the highlighting for it.
                */
                if (get_var_value((char_u *)"syntax_on") != NULL)
                ! (void)cmd_runtime((char_u *)"syntax/syncolor.vim", FALSE);
                #endif
                }

                --- 5863,5869 ----
                * If syntax highlighting is enabled load the highlighting for it.
                */
                if (get_var_value((char_u *)"syntax_on") != NULL)
                ! (void)cmd_runtime((char_u *)"syntax/syncolor.vim", TRUE);
                #endif
                }


                --
                It was recently discovered that research causes cancer in rats.

                /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
                ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
                \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
              Your message has been successfully submitted and would be delivered to recipients shortly.