Changing vim 'gutter' color - vim

See the screenshot of how I have vim configured below. The 'gutter' i.e. where the '+' and '~' symbols appear show my git status using this amazing sublime text port for vim: https://github.com/airblade/vim-gitgutter
How do I change the color of the gutter where there are no '+'/'~' symbols? I.e. the grey part? This is how you change the number column: VIM initial settings: change backgound color for line number on the left side? but I can't find how to change the 'gutter' color.
Any ideas?
Many thanks.

This "gutter" is called the signs column. (See :help signs for more information.) The highlight group associated with this column is called SignColumn, and can be set like this (using the example from the help section):
:highlight SignColumn guibg=darkgrey

To change the color in your ~/.vimrc so that your gutter is the same color as where your line numbers show up is the following:
highlight clear SignColumn
The git-gutter docs have some other helpful suggestions.

Another option that hasn't been mentioned is to eliminate the sign column entirely and put the signs into the number column.
Adding this to your ~/.vimrc
set signcolumn=number
produces
(this is using custom symbols with the Ale plugin in iterm Vim).
This is available in "full" Vim versions 7.4.2201 or newer that include the +signs feature (I use the version installed by Homebrew on MacOS).

From the screenshot, I think you're using https://github.com/altercation/vim-colors-solarized/ as your colorscheme, as I was. Another solution for this particular case is to switch to https://github.com/ericbn/vim-solarized, as #altercation's version has a bunch of open PRs fixing that very issue and no changes in the last decade.

Related

How to get matching brace highlighting without cursor jump in vim

I am running vim 7.3 on several machines. By default MatchParen is enabled on all of my instances. Using gvim on my windows machine, it is doing exactly what I want - when my cursor is on a bracket, paren, etc. it visually highlights the match. It does not affect cursor navigation. However, on my Ubuntu boxes, when I move the cursor onto the character, it actually jumps to the match.
I'm sure that the behavior is caused by MatchParens because if I do a :NoMatchParen, it stops. Unfortunately, I also don't get the highlighting at that point. I can't figure out where my settings differ, though.
I'll like you even more if you can point me towards a plugin that will always highlight the closest enclosing pair of characters around my current position (like a code oriented version of MatchTagsAlways)
When showmatch is set, the cursor is actually jumping, and the following line fixes the problem:
set matchtime=0
More details:
http://vimdoc.sourceforge.net/htmldoc/options.html#'matchtime'
Just like FDinoff said in the accepted answer, this is probably only a problem of colors.
So if the color of the matching "paren" disorients you, tweaking colors of background and foreground is likely the solution.
But HOW do you do this?? ^^
I've had quite a journey through the vimdoc (it was not easy).
I've tested a whole bunch of variables and found that the relevant tweak is the [hi]ghlight command and specifically the MatchParen group.
The solution
Adding this in my .vimrc did the trick:
hi MatchParen ctermfg=208 ctermbg=bg
Note that vim config files are read from top to bottom, and some types of "words" are matched by several options. For example, a boolean could also be a keyword. Thus you have to pay attention to the order of these options.
How does this work?
My problem was that the background had the flashy color while the foreground had the color of the background of my terminal, which made it really confusing. Thus switching colors was the solution for me. But maybe you will have to tweak it differently.
First, you can check the current value for highlight MatchParen by entering the following command (while inside vim, in normal mode):
:hi MatchParen
You'll see hi MatchParen followed by XXX in the current style, followed by a list of argument=value separated by spaces.
The important arguments are ctermfg and ctermbg for the "terminal" vim, guifg and guibg for the "gui" vim. (Where fg means foreground and bg means background)
You can change a value and see the result in real time. Just put your cursor over a match character and enter the following command:
:hi MatchParen SomeArgument=SomeValue
This will not be saved, so don't worry. When you find a proper combination of values, you can add them in your .vimrc as shown above.
Personally, I set ctermfg to 208 (orange color) and ctermbg to bg (a keyword for the current background color, if known by vim).
If you use vim in a gui, take a look here for the available choice of colors.
The cursor isn't jumping. The color scheme probably has defined bad colors for the MatchParen highlight group which makes it look like the cursor is jumping.
Running default gVim (v7.4.461) without any configuration (i.e. no .vim files) in openSUSE 13.2 Legacy 32 Bit, :set showmatch? reveals that showmatch is on at start, which is not Vim's stated default behaviour. We can account for this by adding :set noshowmatch in our .vimrc.

How to change the color of Vim's (straight) underline?

I've tried everything changing the color of this:
call s:h("Underlined", {"fg": s:norm, "gui": "underline", "cterm": "underline"})
As well as all the colors of the link texts.
Does anybody know how to change it?
Here's a picture:
For anyone finding that in 2021, you can use guisp=red in neovim at least.
For example I use
:hi CocErrorHighlight gui=undercurl guisp=red
to have red curly lines.
I am using NeoVim in the Xfce-Terminal.
For a long time, you couldn't; the underline color always equaled the text color. AFAICT, in terminals this wasn't supported, and for consistency, Vim also didn't offer this in GVIM.
With Vim 8.2.0863, the ctermul attribute allows setting a separate color for underline / undercurl now. Apparently, this still isn't supported in GVIM, though (which I find odd, because Vim usually values consistency in features over fancy stuff (as explained by :help design-not)).
In GVIM, you could switch to the (GUI-only) undercurl attribute (mostly used for spell checking), which supports a separate "special color", set via guisp={color-name}; see :help highlight-guisp.
You can colorize underline only with ctermul(independent with ctermfg).
See this commit enabling that.

GVIM : in /root/.vimrc i have ":colorscheme desert" which worked, but where would i have found this value if someone hadn't told me?

So in GVIM i changed the color-scheme to
desert
but i never understood how to find this line
:colorscheme desert
so i could place it in
/root/.vimrc
file.
where would i have found out about " :colorscheme desert " ?
You could read the help (it is quite long and very detailed)
:h
Opens up to the main help for vim. Under getting started you will see the following. You might have to scroll down a bit (Use Control+f to page down)
usr_toc.txt Table Of Contents
Getting Started
usr_01.txt About the manuals
usr_02.txt The first steps in Vim
usr_03.txt Moving around
usr_04.txt Making small changes
usr_05.txt Set your settings
usr_06.txt Using syntax highlighting
usr_07.txt Editing more than one file
usr_08.txt Splitting windows
usr_09.txt Using the GUI
usr_10.txt Making big changes
usr_11.txt Recovering from a crash
usr_12.txt Clever tricks
It seems the that usr_06.txt is related to syntax highlighting so that might be worth reading. So type :h usr_06.txt or <c-]> (Control+]) to jump to that file when your cursor is on top of it.
Once you are in there you can look at the table of contents again.
06.1 Switching it on
06.2 No or wrong colors?
06.3 Different colors
06.4 With colors or without colors
06.5 Printing with colors
06.6 Further reading
Different colors seems to be what you want. So type :h 06.3 (or <c-]>) and the first paragraph talks about changing the colorscheme.
Control+] jumps to a tag and is talked about in :h tagsrch.txt (And on the line "Jump to a subject" immediately as you open :h)
The help have an auto completion feature.
So you can type, :help color followed by Ctrl+d. You won't necessary find the good entry right of the bat but it should put you on the right track. It would have shown you a colorscheme option.
An alternative is to use :helpgrep. :helpgrep color should give you a list of help file wich contains the string color.
On Debian Linux, it's part of the the vim-runtime package and sits in /usr/share/vim/vim73/colors/desert.vim. You can list contents of this direcory for more options. I don't think they have hard-coded color schemes in vim itself, so vim help will not list them for you.
I suppose like most other vim plugins, customized color schemes can also be put in ~/.vim directory.

Getting hilighting in a vim color file

I'm trying to edit my colour scheme in vim, and I remember when I was using Fedora I could get an easy preview of the colour when I changed it.
If I had a line like:
let ColourAssignment['String'] = {"GUIFG": 'LightYellow', "CTERMFG": '118'}
The word ColourAssignment would get hilighted as the colour I set 'string' to.
I'm using a mac now, but I have the same plugins and .vimrc as I had when using fedora.
Does anyone know what I need to set, or what plugin I could use to get this behavior again?
It's not exactly what you ask for (it highlights the colors themselves, not the highlight group name), but I can highly recommend the Colorizer plugin.
Maybe you want :hi String guifg=LightYellow ctermfg=118 and :syn match String /ColourAssignment/?
Alternatively, there are online Vim colorscheme editors, such as:
http://bytefluent.com/vivify/
http://www.vimtax.com/
I found the exact solution I was looking for, it turns out there is a syntax file included with the bandit colour scheme that allows for this functionality.
The repository is:
https://github.com/vim-scripts/bandit.vim

How to change colors for ":sign" area in VIM?

VIM supports :sign command that is widely used in debuggers to display graphical breakpoints to the left. How can i find correct names for background and foreground colors of this area in order to change them?
I believe you're looking for the SignColumn highlight group. For future reference, I found this by running :help highlight, then running the snippet found there that displays all active highlight groups (pasted here for convenience).
:so $VIMRUNTIME/syntax/hitest.vim
The color schemes, to my knowledge best, should be saved in
<home>/.vim/colors
folder. Try some schemes here

Resources