Ⅰ. 插件描述
A color scheme for Vim and Neovim. High-contrast yet easy in the eye.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'fabi1cazenave/kalahari-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'fabi1cazenave/kalahari-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'fabi1cazenave/kalahari-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/fabi1cazenave/kalahari.vim
Ⅳ. 文档说明
# Kalahari
A desert / wombat variant with 256-color and 8-color support.
High contrast for the code content, low-contrast for the user interface.

256-color mode
The default 256-color mode comes in two variants: dark and light.
Set the background accordingly:
" set background=light " for the light version
set background=dark " for the dark version
colorscheme kalahariA keyboard mapping can be handy to switch between these two variants:
nmap <silent><F12> :let &bg = (&bg == 'light' ? 'dark' : 'light')<CR>8-color mode
The 256-color palette is the same on all terminal emulators. The 8-color
palette (a.k.a. “ANSI colors”) entirely depends on your terminal settings.
This is fine if you prefer styling your terminal rather than every CLI
application, e.g. with a theme manager such as pywal.
All (?) terminal emulators support 256 colors nowadays but the 8-color mode can
be forced with the g:kalahari_ansi variable:
if has('termguicolors')
set notermguicolors
endif
set g:kalahari_ansi = 1
colorscheme kalahariIn this mode, switching the background color is done on the terminal side, not
on the Vim side: using set background={dark,light} adjusts some text colors
to match the background but does not change the background color itself.
Italics
Not all terminal emulators support displaying italics, and [it gets even
trickier with Tmux][4].
If the terminal cannot display it, italic text is rendered as normal text
by Neovim (which is acceptable) and reverse text by Vim (which is a pain).
So Vim users have to allow kalahari display italic explicitly:
:set g:kalahari_italic = 1Customization
This color scheme splits is defined in two sections:
- a color palette, which depends on the background (light/dark) and the number of colors (8/16/256);
- a set of highlight rules, which apply colors from the palette to UI elements and syntax groups.
Color Palette
The color palette can be customized with the g:kalahari_palette variable.
Changing the comment colors from gray to purple can be done like this:
let g:kalahari_palette = {
\ 'Comment': 134,
\}
colorscheme kalahariOr, if you prefer to specify colors from all color modes (8/256 & light/dark backgrounds):
let g:kalahari_palette = {
\ 'Comment': [ 5, 5, 177, 134 ],
\}
colorscheme kalahariThe palette identifiers are taken from these lists:
default text and separator colors (gray scale — higher number means lower contrast):
fg_1,fg_2,fg_3,fg_4,fg_5for the text,fg_1being the default text colorbg_1,bg_2,bg_3,bg_4,bg_5for the separators,bg_1being the default background color
- UI colors:
NonText,ModeMsg,Question,SpecialKey,Search_bg,Visual_bg,WarningMsg,Cursor,Cursor_bg— see:h highlight-groups; - syntax colors:
Constant,IdentifierStatement,PreProc,Type,Special,Underlined,Comment,Ignore,Error,Error_bg,Todo,Todo_bg— see:h group-name.
Highlight Groups
Highlight groups can be redefined with the g:kalahari_groups variable. The foreground & background should be a name from the color palette, but a numeric value can be used as well if you want to keep the same color in both dark & light modes.
" group name foreground background decoration
let g:kalahari_groups = [
\ [ 'CursorLine', '', 'bg_1', 'underline' ],
\ [ 'StatusLine', 16, 'Visual_bg', 'none' ],
\ [ 'TabLineSel', 16, 'Visual_bg', 'none' ],
\]
colorscheme kalahariRelated Color Schemes & Plugins
The following color schemes also have dark & light variants that can be
selected by setting the background accordingly:
- rakr/vim-one (my favorite lower-contrast theme)
- rakr/vim-two-firewatch
- junegunn/seoul256.vim
- noahfrederick/vim-hemisu
- freeo/vim-kalisi
- zanglg/nova.vim
- MvanDiemen/ghostbuster
- chmllr/elrodeo-vim-colorscheme: a low-contrast
ghostbustervariant - lifepillar/vim-solarized8: a
solarizedvariant that works on Neovim
The color schemes below look nice too but I couldn’t make them work properly with Neovim:
- altercation/vim-colors-solarized: official
solarizedtheme - Slava/vim-colors-tomorrow: another
solarizedvariant - jsit/disco.vim
These plugins may also be worth mentioning:
- rakr/vim-togglebg, to manually toggle the background between dark and light modes;
- amdt/sunset, to automatically toggle the background mode when the sun rises and sets.