This script *might* be of some help to you:
It's intent is to *display* the highlight settings of the thing under
your cursor (I find that very useful), which includes syntax group name,
and what it's linked to, if any (e.g., "manTitle->Title", color setting
(name and number; e.g., "guifg=Magenta(#ff00ff)" ), and attribute
settings (e.g., "gui=bold").
Perhaps using the guts of that script, but manipulating the "results"
from it would be helpful (at least the nitty gritty part of extracting
the info is done).
You'd just pick up at the synIDtrans() call, since you know the syntax
id (Visual), and don't need to get that from the cursor position.
Halim, Salman wrote:
>I wanted to come up with a series of syntax highlights that extend an
>existing one; for example, I wanted to have an item called MyVisual that
>looks just like the regular Visual highlighting for the color scheme,
>except is italicized; toward this end, I have created a command called
>Ihi (inherit highlight) that works like this:
>:Ihi MyVisual Visual gui=italic
>This will define a :hi command for MyVisual that will mimic the settings
>for Visual, but will have gui=italic (instead of whatever gui -- often
>bold -- the Visual had). The nice thing about Ihi is that putting it in
>a common place that is read every time syntax changes causes MyVisual to
>mimic the current colorscheme automatically. (This works, and isn't
>part of the question, unless someone has suggestions for improvement;
>Here is my concern: To figure out what Visual contains, I do the
>And then I do substitutions out of @z to figure out the various
>:let guifg = substitute( @z, '.*guifg=\(\w\+\).*', '\1', '' )
>Another one for guibg, gui etc. (Well, I do them in a loop with the
>attribute as a variable so I don't have several let lines like that.)
>Finally, then I change the gui/guifg etc. settings to whatever the user
>specified (if they specified something), compose a new :hi command with
>the new name (MyVisual) and execute it.
>It works, but I was wondering if there might be a better way of
>extracting the information about the highlight settings than the blind
>parsing I'm doing -- a combination of the synID* functions, perhaps?
>Just an effort to make it more efficient (it's not slow right now, but I
>thought I'd make it better).
>The only two things I have to do now are to resolve links (if a
>highlight group links to something else, I ignore its settings right
>now) and another user-specified attribute called gui+ that appends to
>the current gui settings. (So, if gui=bold, and I specify gui+=italic,
>the resulting highlight is specified as gui=bold,italic.)
>What would be nice is if I could come up with a way to specify a
>guifg=darker or lighter or something that would automatically lighten or
>darken the shade in question. I'm thinking of parsing the color value
>from rgb.txt to get the numerical values and then subtracting a fixed
>amount for darker or adding a fixed amount for lighter. Although, I
>think that to maintain the current shade, I should multiply or divide by
>1.2 or something as an absolute difference would change the shade.
>Thoughts there? (I know, I know, that's THREE things I have to do; I
>just thought of this one.)
>Thanks, all, and if there is any interest in this, I'll happily post it
Manager of Applications Programming
Cast & Crew Entertainment Services, Inc.