Home

Awesome

nvim-highlite

Default Settings Preview

lua preview

Introduction

nvim-highlite is a colorscheme template repository with great defaults.

This template's defaults focus on:

  1. Compatibility with semantic highlighting.
  1. Visibility in any range of blue-light.

This template's design focuses on:

  1. Ease of use and rapid development.
  1. Inversion of Control

Installation

Creating Your Own

  1. Fork this repository, or clone it with git clone https://github.com/Iron-E/nvim-highlite.
  2. Follow the instructions in colors/highlite.vim.
chmod +x ./setup.sh
./setup.sh highlite <colorscheme>

Where <colorscheme> is the name of your desired colorscheme.

Whenever you want to update from then on, you can run the update script. This will load the latest upstream changes to the core highlighting library.

Just The Defaults

lazy.nvim

I recommend using lazy.nvim:

local install_path = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(install_path) then
  vim.fn.system {
    'git', 'clone', '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git', '--branch=stable',
    install_path
  }
end

vim.opt.rtp:prepend(install_path)
require('lazy').setup {
  {'folke/lazy.nvim', tag = 'stable'},
  {'Iron-E/nvim-highlite',
    config = function()
      vim.opt.termguicolors = true -- optional
      vim.api.nvim_command 'colorscheme highlite'
    end,
    lazy = false,
    priority = 1000,
    version = '^2.0',
  },
}

Others

  1. Install a plugin manager such as packer.nvim:
-- packer.nvim example
local install_path = vim.fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'

if not vim.loop.fs_stat(vim.fn.glob(install_path)) then
  vim.fn.system {'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}
end

vim.api.nvim_command 'packadd packer.nvim'

return require('packer').startup {function(use)
  use {'wbthomason/packer.nvim', opt = true}
  use 'Iron-E/nvim-highlite'
end}
  1. Specify this colorscheme as your default colorscheme in the init.vim:
" Enable 24-bit color output. Only do this IF your environment supports it.
" This plugin is fully compatible with 8-bit, 16-bit, and 24-bit colors.
set termguicolors
" Use the colorscheme
colorscheme highlite

Or using init.lua:

vim.opt.termguicolors = true
vim.api.nvim_command 'colorscheme highlite'

Usage

This repository in itself is an example of how to use nvim-highlite. Aside from this, the following colorschemes are built using nvim-highlite:

As Dependency

Below is an example of how to use nvim-highlite as a dependency.

-- Import nvim-highlite
local highlite = require('highlite')

-- First, define some colors
local red = {'#FF0000', 1, 'red'}
local black = {'#000000', 0, 'black'}
local white = {'#FFFFFF', 255, 'white'}

-- Highlight 'Identifier'
highlite.highlight('Identifier', {bg = red, fg = black, style = 'bold'})

-- Highlight 'Function' conditionally according to background color.
highlite.highlight('Function', {bg = black, fg = red, light = {bg = white}})

-- Link 'Example' to 'Identifier'
highlite.highlight('Example', 'Identifier')

-- You can also reference specific attributes of another highlight group.
highlite.highlight('AnotherExample', {bg = highlite.group'SpellBad'.bg, fg = white})

As Template

Below is an example of how to use nvim-highlite as a template.

-- First, define some colors
local red = {'#FF0000', 1, 'red'}
local black = {'#000000', 0, 'black'}
local white = {'#FFFFFF', 255, 'white'}

-- Next define some highlight groups.
local highlight_groups = {
  -- Any field which can be set to "NONE" doesn't need to be set, it will be automatically assumed to be "NONE".
  Identifier = {bg = red, fg = black, style = 'bold'},
  -- If your colorscheme should respond to multiple background settings, you can do that too:
  Function = {bg = black, fg = red, light = {bg = white}},
  --[[ Note that light/dark differentiation is completely optional. ]]

  -- You can also reference specific attributes of another highlight group.
  SomethingElse = function(self) return {fg = self.Identifier.fg, bg = self.Function.bg} end,
}

-- The rest is mostly handled by the template.

FAQ

How can I override the highlighting of one specific highlight group in my init.vim?

When using this plugin, it is important to know that you can't just run :hi on a highlight group and expect that its changes will be retained. You must attach them to the ColorScheme autocmd event, as shown below:

packadd nvim-highlite
set termguicolors "optional

" WRONG! Don't do this.
hi! Error guifg=#000000 guibg=#FFFFFF

" Do this instead.
augroup Highlite
  " You can also use `highlite.highlight()` instead of `:hi!`
  autocmd ColorScheme highlite hi! Error guifg=#000000 guibg=#FFFFFF
augroup end

colorscheme highlite

Of course, substitute highlite with the name of your colorscheme.

Why am I receiving E5108: Error executing lua [string ":lua"]:1: module '<colorscheme>' not found?

Ensure your colorscheme's base folder is in Neovim's rtp before sourcing.

What syntax files should I use for X language?

You can either use nvim-treesitter, vim-polyglot, or some of the following:

LanguageSyntax Plugin
ALGOLsterpe/vim-algol68
C++bfrg/vim-cpp-modern
Coqwhonore/Coqtail
Dartdart-lang/dart-vim-plugin
DTracevim-scripts/dtrace-syntax-file
F#ionide/Ionide-vim
GasShirk/vim-gas
Gittpope/vim-git
Gofatih/vim-go
GraphVizliuchengxu/graphviz
HTML5othree/html5
i3confmboughaba/i3config
JavaIron-E/java-syntax
JavaScriptpangloss/vim-javascript
JSONelzr/vim-json
JuliaJuliaEditorSupport/julia-vim
Kotlinudalov/kotlin-vim
LESSgroenewege/vim-less
LLVMrhysd/vim-llvm
Luatbastos/vim-lua
Markdownplasticboy/vim-markdown
MIPSvim-scripts/mips
Moonscriptleafo/moonscript-vim
PlantUMLaklt/plantuml-syntax
Prettierprettier/vim-prettier
Pythonvim-python/python-syntax
Razorjlcrochet/vim-razor
RSTmarshallward/vim-restructuredtext
Rubyvim-ruby/vim-ruby
RustIron-E/rust.vim
SCSScakebaker/scss-syntax
Shellarzg/vim-sh
SQLshmup/vim-sql-syntax
Styluswavded/vim-stylus
SystemDwgwoods/vim-systemd-syntax
SystemTapnickhutchinson/vim-systemtap
TeXlervag/vimtex
TOMLIron-E/vim-toml
UngrammarIron-E/vim-ungrammar
VB.NETvim-scripts/vbnet
Vim LogsMTDL9/vim-log-highlighting
XMLamadeus/vim-xml
YAMLIron-E/vim-yaml
YATSHerringtonDarkholme/yats

Contribution

This repository is looking for contributions! The following things are appreciated:

If you would like to contribute something, and you aren't sure how, open a ticket! I'd love to help you help me.