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

Re: hi Comment guifg=white guibg=black in ~/.vimrc ignored

Expand Messages
  • Hugh Sasse
    ... [...] Then try ... to see which scripts have been loaded in what order, that way you ll have an idea what is picked up after your .vimrc and for the case
    Message 1 of 18 , Mar 1, 2007
    • 0 Attachment
      On Thu, 1 Mar 2007, Alexander Farber wrote:

      > no, unfortunately this doesn't change anything.
      > I've had those in my ~/.vimrc originally:
      [...]

      Then try
      :scriptnames
      to see which scripts have been loaded in what order, that way
      you'll have an idea what is picked up after your .vimrc and
      for the case of syntax files there are likely things which "bend
      your colourscheme to their will", so to speak.

      And you might want to put the comment highlights in
      %HOME%/vimfiles/after/syntax/something.vim

      see the results of

      :set runtimepath?

      for where this might be.

      > Regards
      > Alex
      >
      >
      > --
      > http://preferans.de
      >
    • Alexander Farber
      Hello Hugh, ... 1: C: Documents and Settings afarber .vimrc 2: C: Program Files Vim vim70 syntax syntax.vim 3: C: Program Files Vim vim70 syntax synload.vim 4:
      Message 2 of 18 , Mar 1, 2007
      • 0 Attachment
        Hello Hugh,

        On 3/1/07, Hugh Sasse <hgs@...> wrote:
        > :scriptnames

        1: C:\Documents and Settings\afarber\.vimrc
        2: C:\Program Files\Vim\vim70\syntax\syntax.vim
        3: C:\Program Files\Vim\vim70\syntax\synload.vim
        4: C:\Program Files\Vim\vim70\syntax\syncolor.vim
        5: C:\Program Files\Vim\vim70\filetype.vim
        6: C:\Program Files\Vim\vim70\menu.vim
        7: C:\Program Files\Vim\vim70\autoload\paste.vim
        8: C:\Program Files\Vim\vim70\plugin\getscript.vim
        9: C:\Program Files\Vim\vim70\plugin\gzip.vim
        10: C:\Program Files\Vim\vim70\plugin\matchparen.vim
        11: C:\Program Files\Vim\vim70\plugin\netrwPlugin.vim
        12: C:\Program Files\Vim\vim70\plugin\rrhelper.vim
        13: C:\Program Files\Vim\vim70\plugin\spellfile.vim
        14: C:\Program Files\Vim\vim70\plugin\tarPlugin.vim
        15: C:\Program Files\Vim\vim70\plugin\tohtml.vim
        16: C:\Program Files\Vim\vim70\plugin\vimballPlugin.vim
        17: C:\Program Files\Vim\vim70\plugin\zipPlugin.vim
        18: C:\Program Files\Vim\vim70\syntax\actionscript.vim

        so ok, my ~/.vimrc is getting executed (I could also see
        that because all my other setting like font size do work)
        but then the highlight colors get overwritten by something
        (like Yakov told me several times).

        > And you might want to put the comment highlights in
        > %HOME%/vimfiles/after/syntax/something.vim

        Actually I edit .sh, .pl, .c, .h, .java and .as files
        and like to have similar colors (like inverted comments)
        everywhere. So probably this is not the best way?

        > :set runtimepath?

        runtimepath=~/vimfiles,C:\Program Files\Vim/vimfiles,C:\Program
        Files\Vim\vim70,C:\Program Files\Vim/vimfiles/after,~/vimfiles/after

        Regards
        Alex


        --
        http://preferans.de
      • Hugh Sasse
        ... [...] ... Those at least could do it. ... Then I m not really sure what is, hopefully someone else will jump in here.... ... I know that ... would tell you
        Message 3 of 18 , Mar 1, 2007
        • 0 Attachment
          On Thu, 1 Mar 2007, Alexander Farber wrote:

          > Hello Hugh,
          >
          > On 3/1/07, Hugh Sasse <hgs@...> wrote:
          > > :scriptnames
          >
          > 1: C:\Documents and Settings\afarber\.vimrc
          > 2: C:\Program Files\Vim\vim70\syntax\syntax.vim
          > 3: C:\Program Files\Vim\vim70\syntax\synload.vim
          > 4: C:\Program Files\Vim\vim70\syntax\syncolor.vim
          [...]
          > 18: C:\Program Files\Vim\vim70\syntax\actionscript.vim

          Those at least could do it.
          >
          > so ok, my ~/.vimrc is getting executed (I could also see
          > that because all my other setting like font size do work)
          > but then the highlight colors get overwritten by something
          > (like Yakov told me several times).
          >
          > > And you might want to put the comment highlights in
          > > %HOME%/vimfiles/after/syntax/something.vim
          >
          > Actually I edit .sh, .pl, .c, .h, .java and .as files
          > and like to have similar colors (like inverted comments)
          > everywhere. So probably this is not the best way?

          Then I'm not really sure what is, hopefully someone else will
          jump in here....
          >
          > > :set runtimepath?
          >
          > runtimepath=~/vimfiles,C:\Program Files\Vim/vimfiles,C:\Program
          > Files\Vim\vim70,C:\Program Files\Vim/vimfiles/after,~/vimfiles/after

          I know that
          :set verbose=10
          would tell you where varaiables were set, but I don't know how to find
          out when a command like `hi comment ...` was used....

          >
          > Regards
          > Alex
          >
          Hugh
        • Peter Hodge
          ... Hello, If you insist on having your colors inside .vimrc, then you can do it like this: augroup MyColors autocmd! autocmd ColorScheme * hi Cursor
          Message 4 of 18 , Mar 1, 2007
          • 0 Attachment
            --- Hugh Sasse <hgs@...> wrote:

            > On Thu, 1 Mar 2007, Alexander Farber wrote:
            >
            > > Hello Hugh,
            > >
            > > On 3/1/07, Hugh Sasse <hgs@...> wrote:
            > >
            > > Actually I edit .sh, .pl, .c, .h, .java and .as files
            > > and like to have similar colors (like inverted comments)
            > > everywhere. So probably this is not the best way?
            >
            > Then I'm not really sure what is, hopefully someone else will
            > jump in here....

            Hello,

            If you insist on having your colors inside .vimrc, then you can do it like
            this:

            augroup MyColors
            autocmd!
            autocmd ColorScheme * hi Cursor term=inverse ctermfg=black
            guifg=black guibg=green
            autocmd ColorScheme * hi Visual term=inverse ctermfg=yellow
            ctermbg=black guifg=yellow guibg=black
            autocmd ColorScheme * hi Comment term=inverse ctermfg=white
            ctermbg=black guifg=white guibg=black
            autocmd ColorScheme * hi Identifier term=NONE ctermfg=black
            guifg=black
            autocmd ColorScheme * hi Constant term=underline ctermfg=red
            guifg=red
            autocmd ColorScheme * hi Statement term=bold ctermfg=blue
            guifg=blue
            autocmd ColorScheme * hi PreProc term=NONE ctermfg=black
            guifg=black gui=underline
            autocmd ColorScheme * hi Special term=NONE ctermfg=red
            guifg=red
            autocmd ColorScheme * hi Type term=bold ctermfg=blue
            guifg=blue
            augroup end

            otherwise, you can download my AfterColors plugin:

            http://www.vim.org/scripts/script.php?script_id=1641

            and move your highlight commands into $HOME\vimfiles\after\colors\common.vim'.

            regards,
            Peter



            Send instant messages to your online friends http://au.messenger.yahoo.com
          • Mark Woodward
            Hi alex, ... Is this Vim or gVim? If the later, where s the .gvimrc file? If the former, putting guifg=... in the .vimrc is meaningless. If you re using gVim
            Message 5 of 18 , Mar 2, 2007
            • 0 Attachment
              Hi alex,

              On Thu, 2007-03-01 at 16:33 +0100, Alexander Farber wrote:
              > Hello Hugh,
              >
              > On 3/1/07, Hugh Sasse <hgs@...> wrote:
              > > :scriptnames
              >
              > 1: C:\Documents and Settings\afarber\.vimrc
              > 2: C:\Program Files\Vim\vim70\syntax\syntax.vim
              > 3: C:\Program Files\Vim\vim70\syntax\synload.vim
              > 4: C:\Program Files\Vim\vim70\syntax\syncolor.vim
              > 5: C:\Program Files\Vim\vim70\filetype.vim
              > 6: C:\Program Files\Vim\vim70\menu.vim
              > 7: C:\Program Files\Vim\vim70\autoload\paste.vim
              > 8: C:\Program Files\Vim\vim70\plugin\getscript.vim
              > 9: C:\Program Files\Vim\vim70\plugin\gzip.vim
              > 10: C:\Program Files\Vim\vim70\plugin\matchparen.vim
              > 11: C:\Program Files\Vim\vim70\plugin\netrwPlugin.vim
              > 12: C:\Program Files\Vim\vim70\plugin\rrhelper.vim
              > 13: C:\Program Files\Vim\vim70\plugin\spellfile.vim
              > 14: C:\Program Files\Vim\vim70\plugin\tarPlugin.vim
              > 15: C:\Program Files\Vim\vim70\plugin\tohtml.vim
              > 16: C:\Program Files\Vim\vim70\plugin\vimballPlugin.vim
              > 17: C:\Program Files\Vim\vim70\plugin\zipPlugin.vim
              > 18: C:\Program Files\Vim\vim70\syntax\actionscript.vim

              Is this Vim or gVim?
              If the later, where's the .gvimrc file?
              If the former, putting guifg=... in the .vimrc is meaningless.

              If you're using gVim create a .gvimrc file in the same directory as
              the .vimrc. Place the guifg=... stuff in there.

              What is the output of scriptnames now?
              Is the syntax as you'd like it now?


              cheers,


              --
              Mark
            • A.J.Mechelynck
              ... It s perfectly possible to run gvim with no gvimrc (it does source the vimrc). :highlight commands would sit better in a colorscheme, but regardless of
              Message 6 of 18 , Mar 2, 2007
              • 0 Attachment
                Mark Woodward wrote:
                > Hi alex,
                >
                > On Thu, 2007-03-01 at 16:33 +0100, Alexander Farber wrote:
                >> Hello Hugh,
                >>
                >> On 3/1/07, Hugh Sasse <hgs@...> wrote:
                >>> :scriptnames
                >> 1: C:\Documents and Settings\afarber\.vimrc
                >> 2: C:\Program Files\Vim\vim70\syntax\syntax.vim
                >> 3: C:\Program Files\Vim\vim70\syntax\synload.vim
                >> 4: C:\Program Files\Vim\vim70\syntax\syncolor.vim
                >> 5: C:\Program Files\Vim\vim70\filetype.vim
                >> 6: C:\Program Files\Vim\vim70\menu.vim
                >> 7: C:\Program Files\Vim\vim70\autoload\paste.vim
                >> 8: C:\Program Files\Vim\vim70\plugin\getscript.vim
                >> 9: C:\Program Files\Vim\vim70\plugin\gzip.vim
                >> 10: C:\Program Files\Vim\vim70\plugin\matchparen.vim
                >> 11: C:\Program Files\Vim\vim70\plugin\netrwPlugin.vim
                >> 12: C:\Program Files\Vim\vim70\plugin\rrhelper.vim
                >> 13: C:\Program Files\Vim\vim70\plugin\spellfile.vim
                >> 14: C:\Program Files\Vim\vim70\plugin\tarPlugin.vim
                >> 15: C:\Program Files\Vim\vim70\plugin\tohtml.vim
                >> 16: C:\Program Files\Vim\vim70\plugin\vimballPlugin.vim
                >> 17: C:\Program Files\Vim\vim70\plugin\zipPlugin.vim
                >> 18: C:\Program Files\Vim\vim70\syntax\actionscript.vim
                >
                > Is this Vim or gVim?
                > If the later, where's the .gvimrc file?
                > If the former, putting guifg=... in the .vimrc is meaningless.
                >
                > If you're using gVim create a .gvimrc file in the same directory as
                > the .vimrc. Place the guifg=... stuff in there.
                >
                > What is the output of scriptnames now?
                > Is the syntax as you'd like it now?
                >
                >
                > cheers,
                >
                >

                It's perfectly possible to run gvim with no gvimrc (it does source the vimrc).
                ":highlight" commands would sit better in a colorscheme, but regardless of
                whether they're in a colorscheme or in the vimrc, it's possible to set both
                cterm[bf]g= and gui[bf]g= (and term= if deemed necessary) in the same ":hi"
                command.

                IIUC, ":syntax on" resets all colors, re-invoking the current colorscheme if
                any: thus it's usually less problematic to define colors in a colorscheme.
                (When default colors are OK, the corresponding highlight groups can be omitted.)

                See (attached) an example colorscheme, which is the one I use for my
                day-to-day editing. It may help you design your own. To use this one, drop it
                in ~/.vim/colors and add

                colorscheme almost-default

                to your vimrc.


                Best regards,
                Tony.
                --
                hundred-and-one symptoms of being an internet addict:
                79. All of your most erotic dreams have a scrollbar at the right side.
              • Alexander Farber
                Hello all, I have received many nice replies, thank you! Unfortunately none of them worked for me yet, lest editing C: Program
                Message 7 of 18 , Mar 2, 2007
                • 0 Attachment
                  Hello all,

                  I have received many nice replies, thank you!

                  Unfortunately none of them worked for me yet,
                  lest editing C:\Program Files\Vim\vim70\syntax\syncolor.vim
                  which is not what I need (please read below why).

                  May I rephrase my question please?

                  Does anybody please have a line, which I could
                  put into my ~/.vimrc and which would invert the
                  color of Comment's in vim and gvim on any OS?

                  And here is the background: I work on different
                  machines (servers, PCs, laptops) and OSs (Windows,
                  Cygwin, Solaris, HP, Linux and at home OpenBSD).
                  And I edit c/java/perl/shell/actionscript source code.

                  Until now I was very happy with my vim, because
                  I could come anywhere, drop my ~/.vimrc into home dir
                  (with: hi Comment term=inverse ctermfg=white
                  ctermbg=black guifg=white guibg=black )

                  and start working in 2 minutes (laughing at the emacs
                  and other editor users, who would run around and whine,
                  that something doesn't work for them).

                  Unfortunately as of Vim 7.0 this does not work for me.
                  And while I can edit ...\Vim\vim70\syntax\syncolor.vim
                  on a PC, I don't have permissions on Unix to do that.

                  So does anybody has a line for ~/.vimrc for me, so that
                  I put that file on my USB-keychain and on my web server
                  and can reuse it anywhere? Thank you very much

                  Regards
                  Alex

                  --
                  http://preferans.de
                • Yukihiro Nakadaira
                  You should set background option. set background=light or dark hi ... hi ... If background option is not set, Vim may change it while initializing GUI
                  Message 8 of 18 , Mar 2, 2007
                  • 0 Attachment
                    You should set 'background' option.

                    set background=light " or dark
                    hi ...
                    hi ...

                    If 'background' option is not set, Vim may change it while initializing
                    GUI (after vimrc is sourced). Then "syntax/syncolor.vim" is sourced and
                    highlight settings are reset.

                    --
                    Yukihiro Nakadaira - yukihiro.nakadaira@...
                  • Alexander Farber
                    Yukihiro-San, you re genius! ... After I ve done that, my old ~/.vimrc started working as before again, thank you very much: syntax on set bg=light hi Cursor
                    Message 9 of 18 , Mar 2, 2007
                    • 0 Attachment
                      Yukihiro-San, you're genius!

                      On 3/2/07, Yukihiro Nakadaira <yukihiro.nakadaira@...> wrote:
                      > You should set 'background' option.
                      >
                      > set background=light " or dark
                      > hi ...
                      > hi ...
                      >
                      > If 'background' option is not set, Vim may change it while initializing
                      > GUI (after vimrc is sourced). Then "syntax/syncolor.vim" is sourced and
                      > highlight settings are reset.

                      After I've done that, my old ~/.vimrc started working
                      as before again, thank you very much:

                      syntax on
                      set bg=light

                      hi Cursor term=inverse ctermfg=black guifg=black guibg=green
                      hi Visual term=inverse ctermfg=yellow ctermbg=black guifg=yellow
                      guibg=black
                      hi Comment term=inverse ctermfg=white ctermbg=black guifg=white guibg=black
                      hi Identifier term=NONE ctermfg=black guifg=black
                      hi Constant term=underline ctermfg=red guifg=red
                      hi Statement term=bold ctermfg=blue guifg=blue
                      hi PreProc term=NONE ctermfg=black guifg=black gui=underline
                      hi Special term=NONE ctermfg=red guifg=red
                      hi Type term=bold ctermfg=blue guifg=blue

                      Regards
                      Alex

                      PS: Thank you all others too for your suggestions!
                      (they were a bit to heavy for me though -
                      I guess I need just a vi, with basic syntax highlighting)


                      --
                      http://preferans.de
                    • Mark Woodward
                      Hi Tony, ... I agree gui hi can be set in the _vimrc file. However: However when I enter :verbose hi Comment I get: Comment xxx term=bold ctermfg=1
                      Message 10 of 18 , Mar 3, 2007
                      • 0 Attachment
                        Hi Tony,

                        On Fri, 2007-03-02 at 10:52 +0100, A.J.Mechelynck wrote:
                        > Mark Woodward wrote:
                        > > Hi alex,
                        > >
                        > > On Thu, 2007-03-01 at 16:33 +0100, Alexander Farber wrote:
                        > >> Hello Hugh,
                        > >>
                        > >> On 3/1/07, Hugh Sasse <hgs@...> wrote:
                        > >>> :scriptnames
                        > >> 1: C:\Documents and Settings\afarber\.vimrc
                        > >> 2: C:\Program Files\Vim\vim70\syntax\syntax.vim
                        > >> 3: C:\Program Files\Vim\vim70\syntax\synload.vim
                        > >> 4: C:\Program Files\Vim\vim70\syntax\syncolor.vim
                        > >> 5: C:\Program Files\Vim\vim70\filetype.vim
                        > >> 6: C:\Program Files\Vim\vim70\menu.vim
                        > >> 7: C:\Program Files\Vim\vim70\autoload\paste.vim
                        > >> 8: C:\Program Files\Vim\vim70\plugin\getscript.vim
                        > >> 9: C:\Program Files\Vim\vim70\plugin\gzip.vim
                        > >> 10: C:\Program Files\Vim\vim70\plugin\matchparen.vim
                        > >> 11: C:\Program Files\Vim\vim70\plugin\netrwPlugin.vim
                        > >> 12: C:\Program Files\Vim\vim70\plugin\rrhelper.vim
                        > >> 13: C:\Program Files\Vim\vim70\plugin\spellfile.vim
                        > >> 14: C:\Program Files\Vim\vim70\plugin\tarPlugin.vim
                        > >> 15: C:\Program Files\Vim\vim70\plugin\tohtml.vim
                        > >> 16: C:\Program Files\Vim\vim70\plugin\vimballPlugin.vim
                        > >> 17: C:\Program Files\Vim\vim70\plugin\zipPlugin.vim
                        > >> 18: C:\Program Files\Vim\vim70\syntax\actionscript.vim
                        > >
                        > > Is this Vim or gVim?
                        > > If the later, where's the .gvimrc file?
                        > > If the former, putting guifg=... in the .vimrc is meaningless.
                        > >
                        > > If you're using gVim create a .gvimrc file in the same directory as
                        > > the .vimrc. Place the guifg=... stuff in there.
                        > >
                        > > What is the output of scriptnames now?
                        > > Is the syntax as you'd like it now?
                        > >
                        > >
                        > > cheers,
                        > >
                        > >
                        >
                        > It's perfectly possible to run gvim with no gvimrc (it does source the vimrc).
                        > ":highlight" commands would sit better in a colorscheme, but regardless of
                        > whether they're in a colorscheme or in the vimrc, it's possible to set both
                        > cterm[bf]g= and gui[bf]g= (and term= if deemed necessary) in the same ":hi"
                        > command.
                        >
                        > IIUC, ":syntax on" resets all colors, re-invoking the current colorscheme if
                        > any: thus it's usually less problematic to define colors in a colorscheme.
                        > (When default colors are OK, the corresponding highlight groups can be omitted.)
                        >
                        > See (attached) an example colorscheme, which is the one I use for my
                        > day-to-day editing. It may help you design your own. To use this one, drop it
                        > in ~/.vim/colors and add
                        >
                        > colorscheme almost-default
                        >
                        > to your vimrc.
                        >
                        >
                        > Best regards,
                        > Tony.

                        I agree gui hi can be set in the _vimrc file. However:

                        However when I enter ":verbose hi Comment" I get:

                        Comment xxx term=bold ctermfg=1 guifg=Blue
                        Last set from C:\Program Files\Vim\vim70\syntax\syncolor.vim

                        If the OP had a _gvimrc file it would be sources after the runtime
                        syntax files:

                        /home/mark/.vimrc
                        /home/mark/.vim/filetype.vim
                        /usr/local/share/vim/vim70/filetype.vim
                        /home/mark/.vim/ftdetect/ruby.vim
                        /usr/local/share/vim/vim70/menu.vim
                        /usr/local/share/vim/vim70/autoload/paste.vim
                        /home/mark/.vim/after/filetype.vim
                        /usr/local/share/vim/vim70/ftplugin.vim
                        /usr/local/share/vim/vim70/indent.vim
                        /usr/local/share/vim/vim70/syntax/syntax.vim
                        /usr/local/share/vim/vim70/syntax/synload.vim
                        /usr/local/share/vim/vim70/syntax/syncolor.vim <<<<<<<<<<<<<<<<<
                        /home/mark/.vim/plugin/curr_word.vim
                        /home/mark/.vim/plugin/imaps.vim
                        /home/mark/.vim/plugin/matchit.vim
                        /home/mark/.vim/plugin/netrwPlugin.vim
                        /home/mark/.vim/plugin/project.vim
                        /home/mark/.vim/plugin/rails.vim
                        /home/mark/.vim/plugin/rcodetools.vim
                        /home/mark/.vim/plugin/taglist.vim
                        /usr/local/share/vim/vim70/plugin/getscript.vim
                        /usr/local/share/vim/vim70/plugin/getscriptPlugin.vim
                        /usr/local/share/vim/vim70/plugin/gzip.vim
                        /usr/local/share/vim/vim70/plugin/matchparen.vim
                        /usr/local/share/vim/vim70/plugin/netrwPlugin.vim
                        /usr/local/share/vim/vim70/plugin/rrhelper.vim
                        /usr/local/share/vim/vim70/plugin/spellfile.vim
                        /usr/local/share/vim/vim70/plugin/tarPlugin.vim
                        /usr/local/share/vim/vim70/plugin/tohtml.vim
                        /usr/local/share/vim/vim70/plugin/vimballPlugin.vim
                        /usr/local/share/vim/vim70/plugin/zipPlugin.vim
                        /home/mark/.gvimrc <<<<<<<<<<<<<<<<<
                        /home/mark/.vim/after/color/tweak.vim
                        ...


                        I only source tweak.vim from .gvimrc and like you it's just a 'tweak' of
                        the default colors. For some filetypes (ruby for eg) I have a
                        ruby_cols.vim file in ~/after/ftplugin/ that contains specific hi
                        commands:

                        eg
                        rubyBoolean, rubyComment, rubyDocumentation, rubyData,
                        rubyStringDelimiter, rubyString, rubyNoInterpolation,
                        rubyPseudoVariable, rubyInteger, rubyASCIICode, rubyFloat, rubyEscape,
                        rubyInterpolation, rubyDataDirective, rubyOperator,


                        which basically means I can go overboard tweaking ruby syntax ;-)


                        cheers,


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