From b0bca9edd3d4430f7a07387b72ea2ecaf370d808 Mon Sep 17 00:00:00 2001 From: Iron-E Date: Tue, 26 Jan 2021 14:33:22 -0500 Subject: [PATCH] docs: document overriding groups from init.vim This adds instructions on how to override highlight groups from `init.vim`, as it seems this cannot be done with your average Neovim colorscheme. Rather than just using `:hi!` in the `init.vim` (as one might be tempted to do), it describes a process of adding the commands to an autocommand event which will run them when the time is right. SEE #9 --- README.md | 24 +++++++++++++++++++++++- doc/highlite.txt | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 815b623..1ca9e6c 100644 --- a/README.md +++ b/README.md @@ -123,13 +123,35 @@ local highlight_groups = { ## 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: + +```vim +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 '' 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`](https://github.com/nvim-treesitter/nvim-treesitter), [`nvim-polyglot`](https://github.com/sheerun/vim-polyglot), or one of the following: +You can either use [`nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter), [`nvim-polyglot`](https://github.com/sheerun/vim-polyglot), or some of the following: | Language | Syntax Plugin | |:-----------|:------------------------------------------------------------------------------------------| diff --git a/doc/highlite.txt b/doc/highlite.txt index 261fca6..2b54341 100644 --- a/doc/highlite.txt +++ b/doc/highlite.txt @@ -9,18 +9,19 @@ be configured by cloning the repository and following the README, or individually used to comprehensively highlight groups with its functions. ============================================================================== -0. Table of Contents *highlite-toc* +TABLE OF CONTENTS *highlite-toc* 1. Requirements ............ |highlite-requirements| 2. Usage ................... |highlite-usage| +3. FAQ ..................... |highlite-faq| ============================================================================== -1. Requirements *highlite-requirements* +REQUIREMENTS *highlite-requirements* - Neovim 0.5+ ============================================================================== -2. Usage *highlite-usage* +USAGE *highlite-usage* *highlite.group()* `highlite`.group({group_name}) *highlite-group()* @@ -153,4 +154,33 @@ individually used to comprehensively highlight groups with its functions. |terminal-configuration| Information about how the groups are set. ============================================================================== +FAQ *highlite-faq* + +E5108: Error executing lua [string ":lua"]:1: module '' not found ~ + +Ensure your colorscheme's base folder is in Neovim's `rtp` before sourcing. + +Override the highlighting of one specific highlight group in my init.vim? ~ + +When using this plugin, it is important to know that you cannot 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 "highlight" with the name of your colorscheme. + +=============================================================================== vim:tw=78:ts=4:ft=help:norl: