Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override colorscheme

I often find myself wanting to change just something little in a colorscheme, but i don't want to edit the original file. I tried putting my change in '~/.vim/after/colors/blah.vim', but that doesn't work for me.


Example, I want to change the CursorLine highlight in BusyBee.vim..

~/.vim/colors/BusyBee.vim

I create the file '~/.vim/after/colors/BusyBee.vim' and add this:

hi CursorLine    guibg=#000000 ctermbg=Black cterm=none 

However, i don't see the change. Of course it works if i change the line in the originial BusyBee.vim, but like i said i'd prefer not to do that.

Doing...

:colo Busy<TAB> 

Shows me...

BusyBee  BusyBee 
like image 874
Hannes Avatar asked Mar 13 '10 21:03

Hannes


People also ask

Where does vim install Colorscheme?

To install a new color scheme for Vim, you will need to download it from the git hub repository. Here I am going to download a vim theme “Monokai” from the Git repository. For Monokai color scheme, open the following link, then right-click and save it as . vim in your Downloads directory.

How do I change the background color in vim?

The ctermfg=white is used to set the foreground color to white in a terminal text editor. Finally, the ctermbg=black is used to set the background color to black in a terminal text editor.


2 Answers

You asked what I'm looking for today. I found a simpler solution than those presented here. I want transparent background instead of the black background from the theme, while simply overriding the color after the colorscheme statement in .vimrc doesn't work and installing a plugin just for that is weird. Here is what I did:

autocmd ColorScheme * highlight Normal ctermbg=None autocmd ColorScheme * highlight NonText ctermbg=None 

Why does it work? I guess that vim does something besides just read your colorscheme statement and load the statement and then read your highlight statement and change the color. Anyway it seems like vim only change the color scheme after reading the config files. So I provide a hook, that will change the colors every time the color scheme is changed. A nice side effect is, this works even if you switch your color scheme (you could do an if block if you want to).

like image 91
phunehehe Avatar answered Oct 03 '22 00:10

phunehehe


Have a look at AfterColors.vim, it will enable you to to use the ~/.vim/after/colors/BusyBee.vim method.

like image 24
Beau Avatar answered Oct 03 '22 01:10

Beau