I usually like to make some modifications for the colorschemes I love to match my personal preference. In the past, I had three options:
- Creating a PR for that colorscheme: It's my own preference, and I don't think it's likely to be accepted.
- Maintaining my own fork: I need to track the upstream updates myself.
- Writing ad hoc code for different colors in my
.vimrc: Ugly.
Therefore, I created this plugin to centralize all colorscheme patches in one place, typically in my dotfiles repository, and have them load automatically when I type :color xxx .
Random colorscheme white-sand before patch:
Apply patch white-sand.vim:
hi! SpecialKey term=bold ctermfg=238 guifg=#cac3bcresult:
I am interested in trying out this Emacs colorscheme that has been backported to Vim. However, it has some flaws. This plugin helps me fix it permanently without modifying the original colors.
Install this plugin with your plugin manager (without lazy loading):
Plug 'skywind3000/vim-color-patch'Setup the patch search path:
let g:cpatch_path = '~/.vim/colors/patch'And script with the same name will be loaded in this locations after :color xxx command.
create a new file named desert.vim in the ~/.vim/colors/patch folder:
highlight! LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE
\ gui=NONE guifg=#585858 guibg=NONEand this script will be loaded after executing:
:color desertAnd LineNr in desert will be overrided.
edit ~/.vim/colors/patch/__init__.vim :
if has('win32') || has('win64')
call cpatch#disable_italic()
endifThe __init__.vim is a public script and it will be sourced for every colorscheme.
vim-color-patch provides some help functions like disable_italic() for style tuning.
edit ~/.vim/colors/patch/monokai.vim:
call cpatch#remove_background('SpecialKey')edit ~/.vim/colors/patch/gruvbox.vim:
hi! VertSplit term=reverse ctermfg=239 ctermbg=233 guifg=#64645e guibg=#211F1CAnd VertSplit style in gruvbox will be overrided.
This is where you keep your color patches, when you type:
:color {NAME}This plugin will try to find scripts located in the directory specified by g:cpatch_path and source them in the following order:
__init__.vim__init__.lua{NAME}.vim{NAME}.lua
Default value: "~/.vim/colors/patch".
Can accept a list or a comma separated string.
Disable loading lua files in the patch directory.
Default value: 0 .
This plugin provides some help functions for highlight manipulation:
function cpatch#remove_style(what)argument what can be one of:
['underline', 'undercurl', 'reverse', 'inverse', 'italic', 'bold', 'standout']
function cpatch#disable_italic()same as call cpatch#remove_style("italic") .
function cpatch#disable_bold()same as call cpatch#remove_style("bold") .
function cpatch#remove_background(group)eg. remove background in the SignColumn:
call cpatch#remove_background('SignColumn')Related project:
- vim-color-export: Backport NeoVim colorschemes to Vim !!

