vim-cursorlight


Ⅰ. 插件描述

Set cursorline color to a lighter than the background

Ⅱ. 基本信息

创建日期:  2019-04-29
使用用户:  1
Github星:  1
插件作者:  Joseph Obriot

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'josephobriot/vim-cursorlight'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'josephobriot/vim-cursorlight'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'josephobriot/vim-cursorlight'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/josephobriot/vim-cursorlight

Ⅳ. 文档说明

# Vim-cursorline

A little vim script to set Cursorline background to a lighter version of Normal background

img

For some reason, synIDattr(hlID("Normal"), "bg") doesn't output anything with termguicolors set, so if you use a true color setup this won't work.

Installing

idk use Plug or something

Plug 'josephobriot/vim-cursorlight'

Configuring

Change lightening factor (what is added to the background color)

let g:CursorLightenFactor = x

x must be either :

  • a number, will be added to the red, green and blue values of your background
  • a list of 3 numbers, same as single number x but red, green and blue are treated separately
  1. numbers are added to the decimal values of the colors

So these are correct values :

let g:CursorLightenFactor = 30
let g:CursorLightenFactor = [20, 15, 40]

If you have a light background you would rather set g:EnableCursorDarken, it will use g:CusorLightenFactor in the other way

You can also deactivate the automatic cursorline color change

let g:DisableCursorLighten

Other uses

There are three global functions :

  • lighten a color

    call g:LightenColor(color, rem, method)
    • color must be either a cterm number, a hexadecimal value (with the #), or a color name (like DarkBlue or something)
    • rem can take the same values as g:CursorLightenFactor
    • method must be "hex" or "term", "hex" will return an exact value of lightened color in the form #ff00ff, "term" will return the nearest color in cterm value
    " get current background color
    let background_current = synIDattr(hlID("Normal"), "bg")
    exec "hi Search guibg=" . g:LightenColor(background_current, 30, "hex")
  • darken a color

    call g:DarkenColor(color, rem, method)

    same but rem value(s) are multiplied by -1

  • activate cursorline change

    call g:CursorLight()  " lighten the cursorline
    call g:CursorShadow() " darken the cursorline

添加新评论