Giter Site home page Giter Site logo

greg17477 / vim-hexokinase Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rrethy/vim-hexokinase

0.0 0.0 0.0 105 KB

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)

Lua 0.04% Makefile 0.29% Vim Script 99.67%

vim-hexokinase's Introduction

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 RRethy#10.

vim-hexokinase's People

Contributors

rrethy avatar chitoku-k avatar hexium310 avatar ghid avatar braunbearded avatar kevinhwang91 avatar nkakouros avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.