Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would expect the <code>~/.vim/after/syntax/vim.vim</code> approach to work, but if the keyword (yellow) is already highlighted, you may need to change the matcher with something like:</p> <pre><code>syn keyword yellow yellow containedin=ALL </code></pre> <p>What is the file you're trying to highlight?</p> <p><b>Edit</b></p> <p>I've had a look at the java.vim file and it looks like there's a lot of overlapping syntax groups, which can make highlight customisation quite difficult. Here's what I did, in case it's helpful.</p> <p>A useful mapping is:</p> <pre><code>" What is the current syntax highlighting group? map &lt;F3&gt; :echo "hi&lt;" . synIDattr(synID(line("."),col("."),1),"name") . '&gt; trans&lt;' . synIDattr(synID(line("."),col("."),0),"name") . "&gt; lo&lt;" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . "&gt;" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#") . " BG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"bg#")&lt;CR&gt; </code></pre> <p>You can then move the cursor over something you're interested in and press <kbd>F3</kbd> to see what the current highlight group is. As a test, I opened java.vim in the syntax directory and went to line 52, which defines a javaStorageClass. I decided to highlight the word <code>transient</code> on that line (as <code>yellow</code> wasn't in the file anywhere and I needed something to work with).</p> <p>I moved the cursor over <code>transient</code> and pressed <kbd>F3</kbd>. Vim reported:</p> <pre><code>hi&lt;vimSynKeyRegion&gt; trans&lt;vimSynKeyRegion&gt; lo&lt;vimSynKeyRegion&gt; FG: BG: </code></pre> <p>It is obviously part of a vimSynKeyRegion, which one would guess from the name is a <code>syn region</code>. I decided to look at this further, so I interrogated the current highlighting configuration:</p> <pre><code>:redir @a&gt; :silent syn list :redir END :vnew "ap </code></pre> <p>This produces a file containing all of the syntax information. I searched for <code>vimSynKeyRegion</code> and found this line:</p> <pre><code>vimSynKeyRegion xxx matchgroup=vimGroupName start=/\k\+/ skip=/\\\\\|\\|/ matchgroup=vimSep end=/|\|$/ contained oneline keepend contains=@vimSynKeyGroup </code></pre> <p>The <code>vimSynKeyRegion</code> has been configured to contain items from the syntax cluster named <code>vimSynKeyGroup</code>. Therefore, we can highlight <code>transient</code> by making it a keyword in this group:</p> <pre><code>:syn keyword MyNewGroup transient :hi MyNewGroup guifg=#ff00ff :syn cluster vimSynKeyGroup add=MyNewGroup </code></pre> <hr> <p>Although this may not fit exactly into what you're wanting to do, hopefully it will give you something to work with. You may find some parts cannot be overridden (if they're matched with keywords or similar), but you can always redefine the highlighting to change the colour, e.g.</p> <pre><code>:hi vimGroupName guifg=#ffff00 </code></pre> <p>Hope all of that helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload