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%%%)
Related
I use set list lcs=tab:\❘\ to display tab indenting, and subtly set the color to be slightly lighter than my background. However, CursorLine seems to highlight these in white, which is unwanted. What can I do so that the color does not highlight, but stays the same?
Unfortunately, there's nothing you can do. Vim will use the foreground color of CursorLine, or Normal if the former isn't defined. It currently doesn't "mix" the color definitions from SpecialKey and CursorLine. You could suggest changing this behavior on the vim_dev mailing list.
I find a solution here and it works for me
:highlight MyTabSpace guifg=darkgrey ctermfg=darkgrey
:match MyTabSpace /\t\| /
When customising my vim statusline, I'm able to use the following syntax to make use of the highlight group User1:
set statusline+=%1*
Let's say I have some custom highlights like:
highlight StatusLineStyle ctermbg=34 ctermfg=15 guibg=#00af00 guifg=#ffffff
How can I make use of those custom syntax colourings in my statusline?
Similar to the %N*, there's %#HLname# for custom highlight group names. Actually, it's documented right above that (at :help 'statusline'). So, for your example, use
:set statusline+=%#StatusLineStyle#
Alternatively, you could use the User1..9 styles, and link your highlight group to it:
:highlight link User1 StatusLineStyle
It's explained in :help 'statusline', just above the part on %1*:
# - Set highlight group. The name must follow and then a # again.
Thus use %#HLname# for highlight group HLname. The same
highlighting is used, also for the statusline of non-current
windows.
So…
set statusline+=%#StatusLineStyle#%f#
I fold some of the functions on my C code. When I fold them, the color becomes gray. Is there any way to change the color of folded part to another color?
You can use the :highlight setting. For instance, to set the background to red, add this to your .vimrc:
highlight Folded ctermbg=red
You can view a list of supported colour names by running :source $VIMRUNTIME/syntax/colortest.vim. ctermbg updates the console background; ctermfg updates the console foreground; and guibg & guifg update gvim's background and foreground colours. If you're changing gvim's settings, you can use whatever hex code you like (you don't have to restrict yourself to supported colours).
Type :verbose hi it will describe you all the highlighting groups and where they are defined. There is probably one describing the Fold but I don't know the group name by heart.
Is it possible to define a custom RGB colour for the background colour of VIM?
At the moment I use set background=dark in my .vimrc which assigns #5D5D5D for the background colour. However, I would prefer to have #3F3F3F for my background colour.
Normally your terminal will support only 256 colors, and they are numbered. If you want to use a particular color but don't know the number, the script gui2term.py will help you to find the most approximate one. Or you can just pick one from a table like this one.
If you are designing or modifying for your own color scheme for Vim, you can also use gui2term.py to translate those colors to the numbers.
Once you get the color number you'd like to use, you can edit your color scheme file. changing (or adding) the ctermbg value for the Normal and NonText group may be enough. E.g.:
highlight Normal guifg=#e0e0e0 guibg=#242424 gui=NONE ctermfg=254 ctermbg=235 cterm=NONE
highlight NonText guifg=#99968b guibg=#242424 gui=NONE ctermfg=246 ctermbg=235 cterm=NONE
There is a nice HTML Vim color scheme editor. You can try this to figure out which part uses which group and if you like, edit the colors visually (and run gui2term.py against the result file to make it support color terminals).
I use _vimrc to configure my vim 7.2 (windows) default settings. One setting "set number" will display line numbers on the left side. My vim background color is white (I cannot find setting for this. Maybe the default is white. Anyway I accept this setting).
I would like the background color for line numbers to be Grey or dimmed color. What is the command I can put in my _vimrc to configure this default setting?
highlight LineNr ctermfg=grey ctermbg=white
To make the line number column transparent (the same color as the main background) you can try setting this in your .vimrc:
highlight clear LineNr
You can also clear the so-called sign column (used by gitgutter, etc) as well:
highlight clear SignColumn
This way, no matter what color scheme you use, both columns' background will be compatible.
In my _vimrc, here is the setting:
highlight LineNr guibg=grey
or
hi LineNr guibg=grey
I don't need to set fore-color, the default is yellow and it is OK for me.
guibg and guifg are for vims which are not in terminal. For terminal you use ctermfg ctermbg. Usually in GUI vims you have more colors support and you simply want to avoid the background.
So I usually use this:
highlight LineNr guibg=NONE