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
This commit is contained in:
parent
2798132cdf
commit
b0bca9edd3
24
README.md
24
README.md
|
@ -123,13 +123,35 @@ local highlight_groups = {
|
||||||
|
|
||||||
## FAQ
|
## 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 '<colorscheme>' not found`?
|
> 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.
|
Ensure your colorscheme's base folder is in Neovim's `rtp` before sourcing.
|
||||||
|
|
||||||
> What syntax files should I use for `X` language?
|
> 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 |
|
| Language | Syntax Plugin |
|
||||||
|:-----------|:------------------------------------------------------------------------------------------|
|
|:-----------|:------------------------------------------------------------------------------------------|
|
||||||
|
|
|
@ -9,18 +9,19 @@ be configured by cloning the repository and following the README, or
|
||||||
individually used to comprehensively highlight groups with its functions.
|
individually used to comprehensively highlight groups with its functions.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
0. Table of Contents *highlite-toc*
|
TABLE OF CONTENTS *highlite-toc*
|
||||||
|
|
||||||
1. Requirements ............ |highlite-requirements|
|
1. Requirements ............ |highlite-requirements|
|
||||||
2. Usage ................... |highlite-usage|
|
2. Usage ................... |highlite-usage|
|
||||||
|
3. FAQ ..................... |highlite-faq|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
1. Requirements *highlite-requirements*
|
REQUIREMENTS *highlite-requirements*
|
||||||
|
|
||||||
- Neovim 0.5+
|
- Neovim 0.5+
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2. Usage *highlite-usage*
|
USAGE *highlite-usage*
|
||||||
|
|
||||||
*highlite.group()*
|
*highlite.group()*
|
||||||
`highlite`.group({group_name}) *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.
|
|terminal-configuration| Information about how the groups are set.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
FAQ *highlite-faq*
|
||||||
|
|
||||||
|
E5108: Error executing lua [string ":lua"]:1: module '<colorscheme>' 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:
|
vim:tw=78:ts=4:ft=help:norl:
|
||||||
|
|
Loading…
Reference in New Issue