I have installed syntastic on VIM to help me show errors in PHP code however with the current colorscheme/setting I have to following colors:
As you can see it's very hard to read, I wonder if there is a way to change the color if this error window specifically.
If this is only for the current selected item in the quickfix window, that's the Search highlight group on top of the normal quickfix highlighting. You then have to change either one; the Search group will affect search results in other windows, too.
If this is other / special Syntastic highlighting, you best look through all groups in the :hi output to find the bad one.
Overriding
Unless you want to completely switch your colorscheme, you can adapt individual highlight groups via :highlight commands after the :colorscheme command in your ~/.vimrc. Either :hi link to another predefined group, or provide your own ctermfg=... guifg=... etc. color definitions, as described by :help highlight-args.
Syntastic doesn't change (nor cares about) highlighting of the error window. It's a plain quickfix window, with filetype qf. Looking at syntax/qf.vim, the default highlighting is this:
syn match qfFileName "^[^|]*" nextgroup=qfSeparator
syn match qfSeparator "|" nextgroup=qfLineNr contained
syn match qfLineNr "[^|]*" contained contains=qfError
syn match qfError "error" contained
hi def link qfFileName Directory
hi def link qfLineNr LineNr
hi def link qfError Error
Thus, if you see the quickfix window in different colours than the main text, it's because your colour scheme has specifically intended it to look that way. You can override highlighting for qfFileName, qfSeparator, qfLineNr, and qfError to make it more readable, but the better solution IMO would be to use a less broken colour scheme.
Edit: Vim 8.0.641 and later has QuickFixLine.
When writing a syntax highlighter for vim you can use the following:
highlight link foo Identifier
However, can I use a custom color, say Grey?
Instead of linking to an existing highlight group, you can specify colors (and attributes like bold and italic). See :help highlight-args for details.
:highlight foo ctermfg=Grey guifg=Grey
How do I change the background color of vim's ruler? Currently, I am using this colorscheme: https://github.com/thayerwilliams/vimbrant/blob/master/vimbrant.vim. The ruler doesn't have a distinct background color.
The "ruler" is something else (:help ruler), what you want is the LineNr highlight group which is defined at multiple locations in your colorscheme:
https://github.com/thayerwilliams/vimbrant/blob/master/vimbrant.vim#L210
https://github.com/thayerwilliams/vimbrant/blob/master/vimbrant.vim#L217
https://github.com/thayerwilliams/vimbrant/blob/master/vimbrant.vim#L320
https://github.com/thayerwilliams/vimbrant/blob/master/vimbrant.vim#L336
https://github.com/thayerwilliams/vimbrant/blob/master/vimbrant.vim#L513
Answering the title question, which brought me here.
The item %#HighlightGroup# will set the highlight group for the rest of the ruler, until you change it with another %#...#. Check :highlight to see all the hl groups. Here is a simple example of a ruler with multiple color groups:
:set rulerformat=%38(%#TabLine#\ %-t\ %m\ %#MatchParen#\ %12(%l:%c%V%)\ %k\ %4p%%%)
This is a screen of vim editing .bash_profile. It seem to have used some weird highlighting that I didn't explicitly turn on (e.g. around GaF)
using nohl doesn't help since I didn't initiate a search. I also tried using 'syntax off', but that just made all the font/text colours white, but the highlights were still in place.
Anyone know what this is, or how to turn it off?
Thanks
remove all highlighting.
hi clear
you can find out the group name and
hi clear group
to disable highlighting on one group
You need to find out which syntax group causes the highlighting. :syn list shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin. When you have the name of the offending syntax group, you see to which highlight group this links to. Then check your colorscheme for its definition:
:highlight <groupname>
For me, I had an issue like this every time I opened the help window for any command. As the user #snowbound said in the comments, doing :set nospell solved the issue.
I want to expand on Kent and Ingo Karkat's answers for those that don't wish to install a plugin.
To find out the name of the highlight group in questions, you can use this:
" call `:exec SynGroup()` to show the highlight group under the cursor
function! SynGroup()
let l:s = synID(line('.'), col('.'), 1)
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
endfun
(My vimscript is bad, and I copied this from somewhere on the internet long ago. Thank you to that person.)
Anyway, as Kent said, you can use
hi clear <group>
to disable the highlighting for that group.
For example, :exec SynGroup() in vimscript comments gives you
vimLineComment -> Comment
Then you can use
hi clear Comment
To remove the highlighting.
If I change Vim's highlight setting, how do I "reload" it for colorschemes to take effect?
So, in my case, I remove highlight's cursor line number
se hl-=N:CursorLineNr
Changing highlight from
highlight=8:SpecialKey,#:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:Mor
eMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:Vert
Split,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:D
iffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:Spel
lCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,
#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn
to
highlight=8:SpecialKey,#:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:Mor
eMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v
:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffCh
ange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRar
e,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:
TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn
(I've emphasized the change.)
But the cursor line number is still "highlighted"!
Changing highlight doesn't update the colorscheme—so how do I "force" an update? I've tried setting syntax coloring off then on again and changing colorschemes to no avail.
If you want to reset/clear a highlight-group, you could use :hi cmd.
in your case, try with:
:hi CursorLineNr NONE #this will disable the hl setting for the given group
:hi clear CursorLineNr #this will set the given group's highlight setting to default.
:h hi to see detail
if you want to reload your colorscheme, you could :color xxx
hope it helps