• This repository has been archived on 22/Nov/2022
  • Stars
    star
    960
  • Rank 47,640 (Top 1.0 %)
  • Language
    Vim Script
  • Created over 5 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

hexokinase.vim - (Neo)Vim plugin for asynchronously displaying the colours in the file (#rrggbb, #rgb, rgb(a)? functions, hsl(a)? functions, web colours, custom patterns)

vim-hexokinase

The fastest (Neo)Vim plugin for asynchronously displaying the colours in the file (#rrggbb, #rgb, rgb(a)? functions, hsl(a)? functions, web colours, custom patterns)

let g:Hexokinase_highlighters = ['virtual']

gif

let g:Hexokinase_highlighters = ['sign_column']

gif

set signcolumn=yes:9 " Neovim only

let g:Hexokinase_highlighters = ['foreground']

let g:Hexokinase_highlighters = ['foregroundfull']

let g:Hexokinase_highlighters = ['background']

let g:Hexokinase_highlighters = ['backgroundfull']

Rationale

Problem: Colorizer and Colorizer are plugins which also display the colour of text. However, they do so by changing the background of the text which is not pleasing to look at. On top of that, they all scrape the file synchronously.

Solution: Have 6 different options for displaying colour, including as virtual text or in the sign column. As well, do all scraping asynchronously.

About

This plugin can display the colour of 6 digit hex codes, 3 digit hex codes, rgb functions, rgba functions, hsl functions, hsla functions, and custom patterns.

Colour can be displayed in each of the 6 six ways shown above, or can be customized to display colour any way the user chooses.

Note: By default all filetypes are scraped and highlighted on ['TextChanged', 'InsertLeave', 'BufRead'], see :h g:Hexokinase_refreshEvents for more info.

Requirements

  • :h 'termguicolors' must be turned on and your terminal must support it
  • Golang must be installed, for more information visit https://golang.org/doc/install.
  • For virtual text: Neovim 0.3.2
  • For sign_column: Vim compiled with +signs or any Neovim version
  • Currently, untested on Windows, help is welcomed.

Installation

  1. Install Golang https://golang.org/doc/install
  2. Install the plugin with the plugin manager of choice and ensure make hexokinase is executed in the project root:
" vim-plug
Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }

" minpac
call minpac#add('rrethy/vim-hexokinase', { 'do': 'make hexokinase' })

" dein
call dein#add('rrethy/vim-hexokinase', { 'build': 'make hexokinase' })

" etc.
  1. :set termguicolors

Quick Start

Choose your method of highlighting:

" Neovim default
let g:Hexokinase_highlighters = [ 'virtual' ]

" Vim default
let g:Hexokinase_highlighters = [ 'sign_column' ]

" All possible highlighters
let g:Hexokinase_highlighters = [
\   'virtual',
\   'sign_column',
\   'background',
\   'backgroundfull',
\   'foreground',
\   'foregroundfull'
\ ]

Choose which patterns are matched:

" Patterns to match for all filetypes
" Can be a comma separated string or a list of strings
" Default value:
let g:Hexokinase_optInPatterns = 'full_hex,rgb,rgba,hsl,hsla,colour_names'

" All possible values
let g:Hexokinase_optInPatterns = [
\     'full_hex',
\     'triple_hex',
\     'rgb',
\     'rgba',
\     'hsl',
\     'hsla',
\     'colour_names'
\ ]

" Filetype specific patterns to match
" entry value must be comma seperated list
let g:Hexokinase_ftOptInPatterns = {
\     'css': 'full_hex,rgb,rgba,hsl,hsla,colour_names',
\     'html': 'full_hex,rgb,rgba,hsl,hsla,colour_names'
\ }

Choose which filetypes to scrape automatically (by default ALL filetypes are scraped):

" Sample value, to keep default behaviour don't define this variable
let g:Hexokinase_ftEnabled = ['css', 'html', 'javascript']

Commands

Command Description
HexokinaseToggle Toggle the colouring
HexokinaseTurnOn Turn on colouring (refresh if already turned on)
HexokinaseTurnOff Turn off colouring

Full Configuration

See :help hexokinase.txt

Custom Patterns

See :help g:Hexokinase_palettes.

This can be used to colour specific variables.

FAQ

I'm seeing grey colours when I toggle vim-hexokinase

You need termguicolors to be turned on. Verify :set termguicolors? outputs termguicolors. For more info, see #10.

More Repositories

1

vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
Lua
2,156
star
2

base16-nvim

Neovim plugin for building a sync base16 colorscheme. Includes support for Treesitter and LSP highlight groups.
Lua
500
star
3

nvim-treesitter-textsubjects

Location and syntax aware text objects which *do what you mean*
Scheme
495
star
4

nvim-treesitter-endwise

Wisely add "end" in Ruby, Vimscript, Lua, etc. Tree-sitter aware alternative to tpope's vim-endwise
Ruby
328
star
5

tcount

Count your code by tokens and patterns in the syntax tree. A tokei/scc/cloc alternative.
Rust
65
star
6

nvim-align

Neovim plugin for aligning text
Lua
40
star
7

ToonUp

Android App that lets you Choose from Thousands of Cartoons/Movies/Animes to Watch for Free
Kotlin
19
star
8

ahocorasick

The fastest Golang implementation of the Aho-Corasick algorithm for string-searching.
Go
18
star
9

dotfiles

My dotfiles: neovim, git, zsh, kitty
Lua
16
star
10

hexokinase

Fast text scraper to find and convert colours (hex, rgb, rgb, hsl, web colours, custom patterns, etc.) into hex values
Go
15
star
11

NOTES-CS246

Object-Oriented Software Development - C++
15
star
12

tagrity

Automatically regenerate your tags on file changes https://rubygems.org/gems/tagrity
Ruby
10
star
13

vim-tranquille

tranquille.vim - Vim plugin for searching without moving the cursor
Vim Script
8
star
14

nvim-hotline

Minimal Lua wrappers for 'statusline' and 'tabline'
Lua
8
star
15

VimHelp

Android app for browsing vim/neovim docs offline
Kotlin
6
star
16

MethodHooker

Xposed module for method hooking Android apps
Java
3
star
17

nvim-animator

Neovim plugin that animates the change in a value for use in animations.
Lua
3
star
18

vim-indexor

indexor.vim - Vim plugin for indexing lists
Vim Script
2
star
19

fzy-rs

fzy scoring algorithm as a Rust crate
Rust
2
star
20

rejects

POC Regular expression implementation using Rust macros to compile the automaton at compile time.
Rust
2
star
21

nvim-sourcerer

Automatically source your init.lua when it gets modified anywhere.
Lua
2
star
22

WordSearch

Kotlin
2
star
23

RhymeTime

Android app for looking up rhymes - Advanced usage example of Dagger.android
Kotlin
2
star
24

cpid1

An init (PID 1) process purpose-built for containers
Rust
1
star
25

SmartyFloaty

Android app that displays overlay and automatically disables it when permissions pop up.
Java
1
star
26

vim-spotlight

Searching through and open Apps using fzf inside Vim.
Vim Script
1
star
27

book

JavaScript
1
star
28

Quasar

Android App that lets you choose any image on your phone to act as a semi-transparent overlay
Java
1
star
29

rwc

Rust implementation of wc with a slightly nicer UI
Rust
1
star
30

nvim-carom

WIP: carom.nvim - execute macros asynchronously
Vim Script
1
star
31

tc

Moved to https://github.com/rrethy/tcount
1
star
32

vim-impiared

impiared.vim - a pair to match plugins of square, round, and curly brackets
Vim Script
1
star
33

cs350-os161-utils

Some utilities to ease the pain of working with os161 in CS350 at UWaterloo
Ruby
1
star
34

kubectl-x

`kubectl` plugin with various useful extensions.
Go
1
star