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\| /
Related
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).
When there's a misspelling (with set spell), it highlights it red (good!), but when the line is highlighted as my current line the red goes away (bad). Removing set cul fixes the problem, but how do I keep the word marked red while being highlighted? I may have multiple words misspelled on a line and also while typing the misspellings are hidden until I go to the next which kinda sucks.
vimrc: https://gist.github.com/OscarGodson/d1b05d52df4ff160b891
colorscheme: https://github.com/tomasr/molokai
1) one could change the vim color scheme, or the SpellBad highlight scheme; one example of the second case is to add in vimrc the following,
hi clear SpellBad
hi SpellBad cterm=bold
2) (not a solution) someone might find 'spell checking while composing' is a bit annoying / distracting and prefer switching the spell checking off until they finish writing the article.
The problem is that the cursorline highlighting has priority over the syntax highlighting (spell errors belong to that), and that cannot be changed. (You can only specify the priority with the newer matchadd() functions.)
I've once raised this issue for error highlighting, but nothing came out of it. (I'd still like to implement a patch for that one day.)
The problem is only about overlap of background highlighting; in GVIM, most color schemes use the undercurl attribute to avoid that issue. In the console, you can only change the highlighting to foreground color, italic or bold attributes to work around it.
workaround
One clever workaround involves swapping the foreground and background colors while adding the reverse attribute: Turn
hi SpellBad cterm=NONE ctermbg=red ctermfg=white
to
hi SpellBad cterm=reverse ctermbg=white ctermfg=red
These two changes cancel each other out normally, but on a CursorLine, the foreground color now contributes to the coloring, turning hard-to-read white-on-cursorline to red-on-cursorline.
Curiously, and jumping off of both answers from the other posters, adding the following in my vimrc made my red background persist accidentally due to my terminal not being able to fulfill the "italic" switch because it can't mix font types like that (I think). I stuck it in the section of my vimrc that is tested for gvim because gvim underlines my spelling mistakes without issue. Give it a try!
if has("gui_running")
#all my gvim settings
else #we're in terminal
hi clear SpellBad
hi SpellBad cterm=bold,italic ctermfg=red
endif
While using Vim for most of my coding, I typically prefer to have the current line under-lined so it's easier to see where I am in my code. I avoid using things like line-highlighting because it usually makes things harder to see with my bright-text-on-dark-background theme (ie: 'torte' colorscheme).
Here is part of my Vim colorscheme:
hi CursorLine guibg=#0F2130 ctermbg=NONE cterm=underline
hi CursorColumn guibg=#0F2130 ctermbg=darkgray cterm=NONE
I then enable these features in my .vimrc file (ie: ~/.vimrc).
So, in my case, the current line has a colored underline which is the inverted color of the character above it, while the current column has a dark-grey background, while all other text just has a black background.
The only problem I am having here is that I cannot see underscore ('_') characters while coding because the underline for the current line is the exact same color and thickness as the underscore characters. The only workaround, if its even possible, that would make sense here is to:
Increase the spacing between lines
Make the underline appear a few pixels further below my text
Is anything like this possible in Vim (not gVIM)?
Thank you.
If you are using gVim:
:hi! def link CursorLine SpellBad
It will use curl-underline.
Changing the linespace to 10+ will display _ above the Cursorline:
:set linespace=10
#kev: +1; It works in gVIM
However, it seems this just can't happen in Vim, as other commenters have noted.
In the end, I just set the background to be dark grey (ie: ctermbg=253), and then set the cursorline to be darker (ie: ctermbg=black cterm=NONE).
From there, I updated my BASHRC file to contain the following:
export TERM=xterm-256color
This, of all luck, ends up looking better than my previous colorscheme. I now have a modified version of the standard "slate" color scheme with a very dark gray background (ie: ctermbg=253) while the current line has a solid black background.
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