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

RE: Whitespace Color setting

Expand Messages
  • Gary Holloway
    The highlight group being used there is Space , try ... (or whatever color you d like instead of Red) -gary btw, I ve found the following to be extremely
    Message 1 of 5 , Dec 4, 2001
      The highlight group being used there is "Space", try

      :hi Space guibg=Red
      (or whatever color you'd like instead of Red)

      -gary

      btw, I've found the following to be extremely useful; it's how I got this
      answer *quickly*.

      I have mapped "-a" to :call SyntaxAttr()
      (you can pick your favorite mapping :)

      And SyntaxAttr is:

      " EXAMPLE SETUP
      "
      " Show the syntax group name of the item under cursor.
      " map -a :call SyntaxAttr()<CR>

      function! SyntaxAttr()
      let synid = ""
      let guifg = ""
      let guibg = ""
      let gui = ""

      let id1 = synID(line("."), col("."), 1)
      let tid1 = synIDtrans(id1)

      if synIDattr(id1, "name") != ""
      let synid = "group: " . synIDattr(id1, "name")
      if (tid1 != id1)
      let synid = synid . '->' . synIDattr(tid1, "name")
      endif
      let id0 = synID(line("."), col("."), 0)
      if (synIDattr(id1, "name") != synIDattr(id0, "name"))
      let synid = synid . " (" . synIDattr(id0, "name")
      let tid0 = synIDtrans(id0)
      if (tid0 != id0)
      let synid = synid . '->' . synIDattr(tid0, "name")
      endif
      let synid = synid . ")"
      endif
      endif

      " Use the translated id for all the color & attribute lookups; the linked id yields blank values.
      if (synIDattr(tid1, "fg") != "" )
      let guifg = " guifg=" . synIDattr(tid1, "fg") . "(" . synIDattr(tid1, "fg#") . ")"
      endif
      if (synIDattr(tid1, "bg") != "" )
      let guibg = " guibg=" . synIDattr(tid1, "bg") . "(" . synIDattr(tid1, "bg#") . ")"
      endif
      if (synIDattr(tid1, "bold" ))
      let gui = gui . ",bold"
      endif
      if (synIDattr(tid1, "italic" ))
      let gui = gui . ",italic"
      endif
      if (synIDattr(tid1, "reverse" ))
      let gui = gui . ",reverse"
      endif
      if (synIDattr(tid1, "inverse" ))
      let gui = gui . ",inverse"
      endif
      if (synIDattr(tid1, "underline"))
      let gui = gui . ",underline"
      endif
      if (gui != "" )
      let gui = substitute(gui, "^,", " gui=", "")
      endif

      echohl MoreMsg
      let message = synid . guifg . guibg . gui
      if message == ""
      echohl WarningMsg
      let message = "<no syntax group here>"
      endif
      echo message
      echohl None
      endfunction


      / FROM: "Luis R. Nunez" <LNunez@...>, Dec 4 17:11 2001
      | ABOUT: RE: Whitespace Color setting
      |
      |
      | > Hi,
      | >
      | > How do I change the color of whitespace, i.e., when syntax "whitespace
      | (add)" is selected? I'm using vim v5.8 with a dark
      | > background. The color of syntax whitespace is salmon (pink) so the
      | contrast with the dark background is minimal.
      | >
      | > I tried the help docs on highlighting and whitespace but didn't find an
      | answer. TIA ..
      | >> Please do not send HTML to this list.
      | OK ...
      |
      | >> I am not sure what you mean by "syntax whitespace."
      | :cal SetSyn("whitespace") OR,
      | From the Syntax pulldown Menu select: Syntax --> WXYZ --> Whitespace (add)
      | When this syntax is selected, all the whitespace area is color highlighted.
      | In my case, it is being highlighted with the color salmon pink. I want to
      | change the color (pink) to one that has better contrast with a dark
      | background.
      | >> Perhaps what you want is
      |
      | >> :hi Normal guibg=NONE
      | Didn't work.
      |
      | >> If this is not what you want, try to be clearer.
      | I hope that adding the command I'm using helps. :cal SetSyn("whitespace")
      | >> What sections of the help files are you looking at?
      | :he highlight AND :he syntax-highlighting
      |
      | HTH --Benji Fisher
      | Thanks ...
      | Luis R. N��ez
      |
      |
      \ END: "Luis R. Nunez"
    • Luis R. Nunez
      Thank you Gary! This is exactly what I needed. A very cool mapping. Luis R. Núñez ... From: Gary Holloway [mailto:gary@castandcrew.com] Sent: Tuesday,
      Message 2 of 5 , Dec 4, 2001
        Thank you Gary! This is exactly what I needed. A very cool mapping.

        Luis R. Núñez

        -----Original Message-----
        From: Gary Holloway [mailto:gary@...]
        Sent: Tuesday, December 04, 2001 5:21 PM
        To: LNunez@...; benji@...
        Cc: vim@...
        Subject: RE: Whitespace Color setting

        The highlight group being used there is "Space", try

        :hi Space guibg=Red
        (or whatever color you'd like instead of Red)

        -gary

        btw, I've found the following to be extremely useful; it's how I got this
        answer *quickly*.

        I have mapped "-a" to :call SyntaxAttr()
        (you can pick your favorite mapping :)

        And SyntaxAttr is:

        " EXAMPLE SETUP
        "
        " Show the syntax group name of the item under cursor.
        " map -a :call SyntaxAttr()<CR>

        function! SyntaxAttr()
        let synid = ""
        let guifg = ""
        let guibg = ""
        let gui = ""

        let id1 = synID(line("."), col("."), 1)
        let tid1 = synIDtrans(id1)

        if synIDattr(id1, "name") != ""
        let synid = "group: " . synIDattr(id1, "name")
        if (tid1 != id1)
        let synid = synid . '->' . synIDattr(tid1, "name")
        endif
        let id0 = synID(line("."), col("."), 0)
        if (synIDattr(id1, "name") != synIDattr(id0, "name"))
        let synid = synid . " (" . synIDattr(id0, "name")
        let tid0 = synIDtrans(id0)
        if (tid0 != id0)
        let synid = synid . '->' . synIDattr(tid0, "name")
        endif
        let synid = synid . ")"
        endif
        endif

        " Use the translated id for all the color & attribute lookups; the
        linked id yields blank values.
        if (synIDattr(tid1, "fg") != "" )
        let guifg = " guifg=" . synIDattr(tid1, "fg") . "(" .
        synIDattr(tid1, "fg#") . ")"
        endif
        if (synIDattr(tid1, "bg") != "" )
        let guibg = " guibg=" . synIDattr(tid1, "bg") . "(" .
        synIDattr(tid1, "bg#") . ")"
        endif
        if (synIDattr(tid1, "bold" ))
        let gui = gui . ",bold"
        endif
        if (synIDattr(tid1, "italic" ))
        let gui = gui . ",italic"
        endif
        if (synIDattr(tid1, "reverse" ))
        let gui = gui . ",reverse"
        endif
        if (synIDattr(tid1, "inverse" ))
        let gui = gui . ",inverse"
        endif
        if (synIDattr(tid1, "underline"))
        let gui = gui . ",underline"
        endif
        if (gui != "" )
        let gui = substitute(gui, "^,", " gui=", "")
        endif

        echohl MoreMsg
        let message = synid . guifg . guibg . gui
        if message == ""
        echohl WarningMsg
        let message = "<no syntax group here>"
        endif
        echo message
        echohl None
        endfunction
      Your message has been successfully submitted and would be delivered to recipients shortly.