📜 ⬆️ ⬇️

Work with color in vim

It would seem that a text editor is not designed to work with color palettes, usually special programs are used for this, one of the quite good programs of this kind, for example, is GPick.
Specialized programs for editing html, at best, offer a simple dialog for choosing a color from a list or a color wheel. But vim and here demonstrates outstanding qualities - extensibility, versatility and the ability to work without a mouse, with one keyboard.

There are several plug-ins that work one way or another with color for vim, but only two seemed convenient to me. About them and will be discussed further. All plug-ins, which are discussed later, work only with the graphic version of the editor, which is understandable. The console version of the color editor in rgb format cannot display.

Display colors inside the buffer-HexHighlight


HexHighlight is a very simple plugin that simply replaces color codes with colored rectangles.
By default, the plugin uses the key combination as a trigger - on / off.
If you look at the text of the plugin, then in the first lines we will see the line:
map :call HexHighlight()



, , , .vimrc.

. leader vim <\> (backslash). , .vimrc
let mapleader =¨ ¨.


vim. , gtk, . , - .
colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

:ColorSel, /, , :

:ColorSel black teal
. /text rgb\hsv . , , .



ColorSel vim "a-"l, , 12 , vim :registers
, , , , , , .

.
hsv. , , , ColorSel , , , - .

, , . , , , - . "" : , , - .

gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

map :call HexHighlight()



, , , .vimrc.

. leader vim <\> (backslash). , .vimrc
let mapleader =¨ ¨.


vim. , gtk, . , - .
colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

:ColorSel, /, , :

:ColorSel black teal
. /text rgb\hsv . , , .



ColorSel vim "a-"l, , 12 , vim :registers
, , , , , , .

.
hsv. , , , ColorSel , , , - .

, , . , , , - . "" : , , - .

gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

map :call HexHighlight()



, , , .vimrc.

. leader vim <\> (backslash). , .vimrc
let mapleader =¨ ¨.


vim. , gtk, . , - .
colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

:ColorSel, /, , :

:ColorSel black teal
. /text rgb\hsv . , , .



ColorSel vim "a-"l, , 12 , vim :registers
, , , , , , .

.
hsv. , , , ColorSel , , , - .

, , . , , , - . "" : , , - .

gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

map :call HexHighlight()



, , , .vimrc.

. leader vim <\> (backslash). , .vimrc
let mapleader =¨ ¨.


vim. , gtk, . , - .
colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

:ColorSel, /, , :

:ColorSel black teal
. /text rgb\hsv . , , .



ColorSel vim "a-"l, , 12 , vim :registers
, , , , , , .

.
hsv. , , , ColorSel , , , - .

, , . , , , - . "" : , , - .

gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

map :call HexHighlight()



, , , .vimrc.

. leader vim <\> (backslash). , .vimrc
let mapleader =¨ ¨.


vim. , gtk, . , - .
colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

:ColorSel, /, , :

:ColorSel black teal
. /text rgb\hsv . , , .



ColorSel vim "a-"l, , 12 , vim :registers
, , , , , , .

.
hsv. , , , ColorSel , , , - .

, , . , , , - . "" : , , - .

gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

map :call HexHighlight()



, , , .vimrc.

. leader vim <\> (backslash). , .vimrc
let mapleader =¨ ¨.


vim. , gtk, . , - .
colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

:ColorSel, /, , :

:ColorSel black teal
. /text rgb\hsv . , , .



ColorSel vim "a-"l, , 12 , vim :registers
, , , , , , .

.
hsv. , , , ColorSel , , , - .

, , . , , , - . "" : , , - .

gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

  1. map :call HexHighlight()



    , , , .vimrc.

    . leader vim <\> (backslash). , .vimrc
    let mapleader =¨ ¨.


    vim. , gtk, . , - .
    colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

    :ColorSel, /, , :

    :ColorSel black teal
    . /text rgb\hsv . , , .



    ColorSel vim "a-"l, , 12 , vim :registers
    , , , , , , .

    .
    hsv. , , , ColorSel , , , - .

    , , . , , , - . "" : , , - .

    gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927
  2. map :call HexHighlight()



    , , , .vimrc.

    . leader vim <\> (backslash). , .vimrc
    let mapleader =¨ ¨.


    vim. , gtk, . , - .
    colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

    :ColorSel, /, , :

    :ColorSel black teal
    . /text rgb\hsv . , , .



    ColorSel vim "a-"l, , 12 , vim :registers
    , , , , , , .

    .
    hsv. , , , ColorSel , , , - .

    , , . , , , - . "" : , , - .

    gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927
  3. map :call HexHighlight()



    , , , .vimrc.

    . leader vim <\> (backslash). , .vimrc
    let mapleader =¨ ¨.


    vim. , gtk, . , - .
    colorsel.vim. RGB/HSV color selector. - David Necas (Yeti) Ingo Karkat.

    :ColorSel, /, , :

    :ColorSel black teal
    . /text rgb\hsv . , , .



    ColorSel vim "a-"l, , 12 , vim :registers
    , , , , , , .

    .
    hsv. , , , ColorSel , , , - .

    , , . , , , - . "" : , , - .

    gpick - http://www.gpick.org/ hexHighlight.vim - http://www.vim.org/scripts/script.php?script_id=2937 colorsel.vim - http://www.vim.org/scripts/script.php?script_id=927

')

Source: https://habr.com/ru/post/265579/


All Articles