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

133620Re: change display colors. which rule causes which color?

Expand Messages
  • geoffrey.wood@thomsonreuters.com
    Oct 2 3:04 AM
    • 0 Attachment
      On Monday, 1 October 2012 23:33:17 UTC+1, Gelonida N wrote:
      > The problem is, that all dark blue colors are very difficult to recognize.
      > Ideally I'd like to change all dark blue vim colors into a lighter blue
      > or another color.

      I have the same problem with dark blue.

      > Is there an easy way to globally change one color with another[?]

      (Using Windows - not sure if this applies under other OSs.)
      Most colours are ultimately defined in vim\vim73\rgb.txt (if
      you're using VIM 7.3 of course).

      You can simply define your own colour in there and then use
      it in your colourscheme or whereever. I add this line

      0 96 255 BobBlue

      and then use it in my colourscheme:

      exe 'hi SpecialKey guifg=BobBlue'
      exe 'hi NonText guifg=BobBlue gui=NONE'
      if !exists("$TERM")
      hi SpecialKey ctermbg=DarkBlue ctermfg=White
      hi NonText ctermbg=DarkBlue ctermfg=White

      You can define it directly in the colourscheme and avoid the
      "exe" complication but then you can't use it in all other places,
      as far as I could tell.

      Since it doesn't work in DOS terminals I use DarkBlue
      background with White text there instead.

      You might be able to just edit the DarkBlue colour instead.
      You'd have to try that to see. Some core colours
      are defined elsewhere though - for example replace all the
      colours in rgb.txt with 77 77 77 and gvim still shows the
      colours like "red" as usual, although "red" is one of the
      lines in the file.

      Another problem is that rgb.txt is kept alongside the
      executable and so upgrades to the vim version will lose your
      changes. You'd expect there to be a way to define your own
      colours under $VIMRUNTIME, e.g., include your own rgb.txt
      there and have it added to the main colours, but I couldn't
      find such a method.

      Therefore I have the code below at the start of my _vimrc,
      and I keep my BobBlue colour and other colours in the file

      It doesn't feel very elegant and there's possibly a better
      way to do it - works for me though.


      " Update rgb.txt with my custom colours - if they don't
      " exist

      " read in my colours and default colours from the file
      let s:my_colours = readfile($VIM . "\\vimfiles\\rgb.txt")
      let s:rgb_file = readfile($VIMRUNTIME . "\\rgb.txt")

      let s:added_colours = 0
      " for each of my colours
      for s:my_colour in s:my_colours
      let s:found=0
      " for each of the default colours...
      for s:line in s:rgb_file
      "...found my colour?
      if s:line =~ s:my_colour
      let s:found=1
      "if didn't find my colour...
      if s:found==0
      " ... add it to the default colours
      let s:rgb_file += [s:my_colour]
      let s:added_colours += 1
      " if we changed the default colours, update the file
      if s:added_colours > 0
      call writefile(s:rgb_file, $VIMRUNTIME . "\\rgb.txt")

      You received this message from the "vim_use" 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
    • Show all 7 messages in this topic