1

This is a sample of the colouring which is provided by the "darkbone.vim" colour scheme (updated):

sample

On the "TMP=" line, the "${ }" delimiters are different from the "TMP" variable name. That is something I want to replicate in another colour scheme file.

However, I am unable to identify the Class which controls the delimiters separately from the variable itself (which I have identified as "PreProc").

Comparing different files, I found that "Delimiter" was not included in darkbone.vim, so I added that, specifying guifg=#FF0000 , but there was no identifiable change to my fullscreen display of the test file, where both the delimiters and the "called" variable name have the same colour.

Anyone have insights into how to control that for the delimiters ?

The 'scriptnames' report is as follows:

scriptnames

If it can make things easier, here is my draft colorscheme file:

"################################################################################################
" This Colour Scheme is NOT part of the VIM distribution
" This Colour Scheme is under development
"################################################################################################
"
" Name:     OASIS_darkbone.vim
" Maintainer:   Eric Marceau
" Last Change:  2021-04-16
" Revision: 0.1

set background=dark
hi clear
if exists("syntax_on")
  syntax reset
endif
let g:colors_name = 'OASIS_darkbone'

""" Trying to identify Class in darkbone.vim controlling variable ${ } displayed using #CD5C5C IndianRed  and TMP showing using #98FB98 PaleGreen

"################################################################################################

"""""""""""""" Group 0  (baseline specification)
hi Normal       guifg=#AFAFAF   guibg=#000000   gui=none        "Confirmed -- All text not mapped to any Syntax Class

"""""""""""""" Group 1
hi Identifier       guifg=#CF9F00   guibg=#000000   gui=bold        "Confirmed -- Variable_DEFINE
hi Statement        guifg=#30BB30   guibg=#000000   gui=bold        "Confirmed -- Flow Control and some commands: while, for, do, done, case, esac, if, then, else, fi, sort, grep, echo, cat, exit, shift, rm,
hi PreProc      guifg=#EFEF8F   guibg=#000000   gui=none        "Confirmed -- Variable_CALL (i.e. ${VAR} )
hi Special      guifg=#FFFFFF   guibg=#000000   gui=none        "Confirmed -- Backquote clauses, EscapeSequences, i.e. "\n, \0, %d, %s, etc...
hi Function     guifg=#4F4FFF   guibg=#000000   gui=bold        "Confirmed -- Function definition wrapper
hi MatchParen       guifg=#000000   guibg=#BBBB00   gui=none        "Confirmed -- Blink on matching parenthesis/brace
"hi Tags        guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified



"""""""""""""" Group 2
hi Comment      guifg=#5F5F9F   guibg=#000000   gui=italic      "Confirmed -- "ctermfg=Brown ctermbg=Black
"hi SpecialComment  guifg=#FF0000   guibg=#000000   gui=italic          "Context was not identified
hi Visual       guifg=#000000   guibg=#707090   gui=none            "Context was not identified
hi VisualNOS        guifg=#9F9FBF   guibg=#000000   gui=none            "Context was not identified
hi Search       guifg=#000000   guibg=#c0c0ff   gui=none            "Context was not identified
hi IncSearch        guifg=#000000   guibg=#c0c0ff   gui=none            "Context was not identified


"""""""""""""" Group 3
hi LineNr       guifg=#6F6F9F   guibg=#000000   gui=none        "Confirmed -- when displayed, number column on left
hi Error        guifg=#ee1111   guibg=#000000   gui=none        "Confirmed -- Error line displayed at bottom
hi StatusLine       guifg=#CFCF4F   guibg=#1F1F4F   gui=bold        "Confirmed -- detailed status line
hi StatusLineNC     guifg=#606080   guibg=#000000   gui=bold,underline      "Context was not identified
hi WarningMsg       guifg=#EFCF8F   guibg=#000000   gui=none            "Context was not identified
hi MoreMsg      guifg=#9F9FBF   guibg=#000000   gui=none            "Context was not identified
hi ErrorMsg     guifg=#FF8F8F   guibg=#000000   gui=none            "Context was not identified
hi ModeMsg      guifg=#9F9FBF   guibg=#000000   gui=none            "Context was not identified
hi WildMenu     guifg=#000000   guibg=#c0c0ff   gui=none            "Context was not identified
hi VertSplit        guifg=#606080   guibg=#606080   gui=none            "Context was not identified
hi Todo         guifg=#8090f0   guibg=#000000   gui=none            "Context was not identified
hi Title        guifg=#c0c0ff   guibg=#000000   gui=bold            "Context was not identified
hi Question     guifg=#9F9FBF   guibg=#000000   gui=none            "Context was not identified
hi Directory        guifg=#e0e0ff   guibg=#000000   gui=bold            "Context was not identified
hi NonText      guifg=#606080   guibg=#101020   gui=none            "Context was not identified
hi SpecialKey       guifg=#404060   guibg=#000000   gui=none            "Context was not identified


"""""""""""""" Group 4
hi CursorLine               guibg=#181818               "Confirmed -- Display controlled in vimrc
hi CursorColumn             guibg=#181818               "Confirmed -- Display controlled in vimrc
hi Cursor       guifg=#000000   guibg=#FF9F1F               "Confirmed -- Current position, normal
"hi iCursor     guifg=#000000   guibg=#C08020                   "Context was not identified
"hi nCursor     guifg=#000000   guibg=#C08020                   "Context was not identified
"hi rCursor     guifg=#000000   guibg=#C08020                   "Context was not identified
"hi lCursor     guifg=#000000   guibg=#C08020                   "Context was not identified
"hi CursorIM        guifg=#000000   guibg=#C08020                   "Context was not identified


"""""""""""""" Group 5
hi Number       guifg=#FF4F1F   guibg=#000000   gui=none        "Confirmed -- Numbers assigned or used
hi String       guifg=#D88F9F   guibg=#000000   gui=none        "Confirmed -- String text and all within awk command quotes
hi Char         guifg=#00FFFF   guibg=#000000   gui=none            "Context was not identified
hi Boolean      guifg=#d0e080   guibg=#000000   gui=none            "Context was not identified
"hi Constant        guifg=#000000   guibg=#FFAFAF   gui=none            "Context was not identified
"hi Float       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified


"""""""""""""" Group 6      (Either     - in original and not used, or 
""""""""""""""                  - harvested from other schemes and not pidgeonholed )
"" Associated with Statement
hi Operator     guifg=#EFEF8F   guibg=#000000   gui=bold        "Confirmed -- Quotes, semicolon ; pipe, Brackets
"hi Conditional     guifg=#FF0000   guibg=#000000   gui=bold        "Confirmed -- do, done, if, then, else, fi; NB overrides default Statement class
"hi Keyword     guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Exception       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Repeat      guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Label       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified


"" Association TBD
"hi Delimiter       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Subtitle        guifg=#c0c0ff   guibg=#000000   gui=italic          "Context was not identified
"hi Ignore      guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Debug       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Underlined      guifg=#9F9FBF   guibg=#000000   gui=underline           "Context was not identified
"hi AltFunction     guifg=#4F4FFF   guibg=#000000   gui=bold            "Context was not identified
"hi AltConstant     guifg=#000000   guibg=#FFAFAF   gui=none            "Context was not identified
"hi Unique      guifg=#000000   guibg=#FFAFAF   gui=none            "Context was not identified
"hi AltUnique       guifg=#000000   guibg=#FFAFAF   gui=none            "Context was not identified
"hi SignColumn              guibg=#000000   gui=none            "Context was not identified


"" Associated with Special
"hi SpecialChar     guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified


"" Associated with Type
"hi Type        guifg=#e0e0ff   guibg=#000000   gui=none            "Context was not identified
"hi AltType     guifg=#e0e0ff   guibg=#000000   gui=none            "Context was not identified
"hi StorageClass    guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Structure       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Typedef     guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified


"" Associated with PreProc
"hi Include     guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Define      guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi Macro       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified
"hi PreCondit       guifg=#FF0000   guibg=#000000   gui=none            "Context was not identified


"""""""""""""" Group 7 (suppressed for impact assessment)
" Diff
"hi DiffAdd     guifg=#8090f0   guibg=#000000   gui=none            "Context was not identified
"hi DiffChange      guifg=#8090f0   guibg=#000000   gui=none            "Context was not identified
"hi DiffDelete      guifg=#8090f0   guibg=#000000   gui=none            "Context was not identified
"hi DiffText        guifg=#8090f0   guibg=#000000   gui=bold            "Context was not identified


"""""""""""""" Group 8
" Folds
hi Folded       guifg=#9F9FBF   guibg=#000000                   "Context was not identified
hi FoldColumn       guifg=#9F9FBF   guibg=#102010                   "Context was not identified


"""""""""""""" Group 9
"if version >= 700
"  " Pmenu - Popup Completion Menu
"  hi Pmenu     guifg=#9F9FBF   guibg=#202040   gui=none            "Context was not identified
"  hi PmenuSel      guifg=#9F9FBF   guibg=#404080   gui=underline           "Context was not identified
"  hi PmenuSbar     guifg=#202040   guibg=#202040   gui=none            "Context was not identified
"  hi PmenuThumb    guifg=#202040   guibg=#202040   gui=none            "Context was not identified
"
"  " Tab
"  hi TabLine       guifg=#606080   guibg=black gui=underline           "Context was not identified
"  hi TabLineFill   guifg=#9F9FBF   guibg=black gui=none            "Context was not identified
"  hi TabLineSel    guifg=#c0c0ff   guibg=#606080   gui=bold            "Context was not identified
"endif


"""""""""""""" Group 10     (for future consideration)
" cool help screens     (from 'anotherdark.vim)
" :he group-name
" :he highlight-groups
" :he cterm-colors


"""""""""""""" Group 11     (for future consideration)
" vim:set ts=8 sts=2 sw=2 tw=0:

1 Answer 1

1

Syntax highlighting is done in two steps:

  1. highlight groups are defined with regular expressions in a "syntax script" and often linked to more generic ones,
  2. visual attributes are assigned to highlight groups in a colorscheme.

The most immediate consequence of this is that the colorscheme can't highlight non-existing highlight groups.

Which leads to our next problem: as per the default syntax script for the sh filetype…

  • ${ belongs to the shDeref and PreProc groups,
  • TMP belongs to shDeref and shDerefVar,
  • } belongs to PreProc,
  • they all resolve to the PreProc highlight group.

meaning that your colorscheme in its current form and the default syntax script for sh make it impossible to highlight ${} and TMP differently.

Here is how the two first lines of your script look with darkbone.vim and the default syntax script for sh:

sh

And here is your screenshot:

op

You will notice that there are quite a few discrepancies.

So, if your colorscheme and the default syntax script both consider ${TMP} as a single "block" belonging to the PreProc highlight group, then you might be using a third-party syntax script that thinks otherwise.

Furthermore, the only highlight group highlighted in orange in your colorscheme is Function so there is definitely something, somewhere, that overrides the default highlight groups in one way or another.

FWIW, you can use the following command to identify the highlight group(s) of the item under your cursor:

command! SynStack echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
Sign up to request clarification or add additional context in comments.

5 Comments

I tried that command you provided at the bottom, both with the "command! " prefix and without it, and I get no perceivable action for the first, and the error msg "E488: Trailing characters" for the latter.
I have suppressed the copy of bash.vim and sh.vim which I had made from my ~/.vim/syntax. I still get the same result.
Thank you, Romaini. That is a very useful snippet. I will let you know when I resolve my issue.
So ... apparently, when cycling thru the various colorscheme files using ScrollColors, vim.org/scripts/script.php?script_id=1488, it became apparent that there is not a full reset between Colour Scheme files being used for display (even though) the files do have the reset line in them at the start! So ... some syntax classes were inhereting colours defined in previous schemes, and applying those! Very confusing. The fact that such dual colour combinations show for ${TMP} implies there must be a way to control it. I will continue my search by trial and error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.