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

Re: ctermbg

Expand Messages
  • Bram Moolenaar
    ... The problem is that Vim cannot ask a color terminal what the default foreground and background colors are (except in the latest xterm, but that hasn t been
    Message 1 of 2 , Feb 6 1:27 PM
    • 0 Attachment
      Charles Campbell wrote:

      > In attempting to get an input('') that doesn't actually echo anything
      > visibly, I'm having a problem; basically, I want to set fg==bg but bg isn't
      > always defined.
      >
      > let _cbg = synIDattr(hlID("Normal"), 'bg', 'cterm')
      >
      > will return -1 when the ctermbg is not defined. However, one
      > cannot
      >
      > hi Normal ...ctermbg=-1 (would make things easy!)
      > hi Normal ...ctermbg=none (no error, but doesn't do it, either)

      The problem is that Vim cannot ask a color terminal what the default
      foreground and background colors are (except in the latest xterm, but that
      hasn't been implemented yet).

      Only when the user sets the colors inside Vim they will be known. Otherwise
      Vim doesn't know what color is actually being used. The 't_me' code is used
      to reset the colors to the normal ones, both background and foreground at the
      same time.

      For the DOS version, you can do

      :hi Normal ctermfg=bg

      That is because the default colors are known for a DOS system.

      --
      "When I die, I want a tombstone that says "GAME OVER" - Ton Richters

      /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
      \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf / /
    Your message has been successfully submitted and would be delivered to recipients shortly.