|
| 1 | +*ex-colors.txt* ex-colors.nvim |
1 | 2 |
|
| 3 | +============================================================================== |
| 4 | +Table of Contents *ex-colors-table-of-contents* |
| 5 | + |
| 6 | + - Requirements |ex-colors-requirements| |
| 7 | + - Installation |ex-colors-installation| |
| 8 | + - Usage |ex-colors-usage| |
| 9 | + - Not in Plan |ex-colors-not-in-plan| |
| 10 | + |
| 11 | + |
| 12 | +REQUIREMENTS *ex-colors-requirements* |
| 13 | + |
| 14 | +- Neovim >= 0.10.4 |
| 15 | + |
| 16 | + |
| 17 | +INSTALLATION *ex-colors-installation* |
| 18 | + |
| 19 | +With lazy.nvim <https://github.com/folke/lazy.nvim>, |
| 20 | + |
| 21 | +>lua |
| 22 | + { |
| 23 | + "aileot/ex-colors.nvim", |
| 24 | + lazy = true, |
| 25 | + cmd = "ExColors", |
| 26 | + ---@type ExColors.Config |
| 27 | + opts = {}, |
| 28 | + } |
| 29 | +< |
| 30 | + |
| 31 | + |
| 32 | +USAGE *ex-colors-usage* |
| 33 | + |
| 34 | + |
| 35 | +STEPS ~ |
| 36 | + |
| 37 | +1. Put `vim.cmd("colorscheme foobar")` in your init.lua. |
| 38 | +2. Restart nvim to refresh highlight definitions. |
| 39 | +3. Load `require("ex-colors").setup()`. |
| 40 | +See |ex-colors-setup| section for the details. |
| 41 | +4. Run `:ExColors` in Command-line mode. |
| 42 | +See |ex-colors-:excolors| section for the details. |
| 43 | +5. Confirm the output with `:write` or `:update`. |
| 44 | +6. Insert `ex-` to your colorscheme name: `vim.cmd("colorscheme ex-foobar")` |
| 45 | +7. Done! |
| 46 | + |
| 47 | + |
| 48 | +SETUP ~ |
| 49 | + |
| 50 | +Change option values via `require("ex-colors").setup()`. The following snippet |
| 51 | +sets up the options with the default values: |
| 52 | + |
| 53 | +>lua |
| 54 | + require("ex-colors").setup({ |
| 55 | + --- The output directory path. The path should end with `/colors` on any |
| 56 | + --- path included in `&runtimepath`. |
| 57 | + ---@type string |
| 58 | + colors_dir = vim.fn.stdpath("config") .. "/colors", |
| 59 | + --- If true, highlight definitions cleared by `:highlight clear` will not be |
| 60 | + --- included in the output. See `:h highlight-clear` for details. |
| 61 | + ---@type boolean |
| 62 | + ignore_clear = true, |
| 63 | + --- If true, omit `default` keys from the output highlight definitions. |
| 64 | + --- See `:h highlight-default` for the details. |
| 65 | + ---@type boolean |
| 66 | + omit_default = true, |
| 67 | + --- (For advanced users only) Return false to discard hl-group. |
| 68 | + ---@type fun(hl_name: string): string|false |
| 69 | + relinker = require("ex-colors.presets").recommended.relinker, |
| 70 | + --- A list of syntax names. Some colorscheme plugins define |
| 71 | + --- filetype-specific syntax highlight groups only on "Syntax" autocmd event |
| 72 | + --- for performance reasons. This option makes sure such lazily-loaded |
| 73 | + --- syntax highlight groups are defined before collecting them. |
| 74 | + ---@type string[] |
| 75 | + required_syntaxes = { |
| 76 | + "markdown", |
| 77 | + }, |
| 78 | + --- Highlight group names which should be included in the output. |
| 79 | + ---@type string[] |
| 80 | + included_hlgroups = require("ex-colors.presets").recommended.included_hlgroups, |
| 81 | + --- Highlight group name Lua patterns which should be included in the output. |
| 82 | + ---@type string[] |
| 83 | + included_patterns = require("ex-colors.presets").recommended.included_patterns, |
| 84 | + --- Highlight group names which should be excluded in the output. |
| 85 | + ---@type string[] |
| 86 | + excluded_hlgroups = require("ex-colors.presets").recommended.excluded_hlgroups, |
| 87 | + --- Highlight group name patterns which should be excluded in the output. |
| 88 | + ---@type string[] |
| 89 | + excluded_patterns = require("ex-colors.presets").recommended.excluded_patterns, |
| 90 | + --- Highlight group name patterns which should be only defined on the |
| 91 | + --- autocmd event patterns. |
| 92 | + ---@type table<string,string[]> |
| 93 | + autocmd_patterns = {}, |
| 94 | + --- Vim global options (`&g:foobar` or `vim.go.foobar`) which should be also |
| 95 | + --- embedded in the colorscheme output to be updated at the same time. |
| 96 | + ---@type string[] |
| 97 | + embedded_global_options = { |
| 98 | + "background", |
| 99 | + }, |
| 100 | + --- Vim global variables (`g:foobar` or `vim.g.foobar`) which should be also |
| 101 | + --- embedded in the colorscheme output to be updated at the same time. |
| 102 | + ---@type string[] |
| 103 | + embedded_global_variables = { |
| 104 | + "terminal_color_0", |
| 105 | + "terminal_color_1", |
| 106 | + "terminal_color_2", |
| 107 | + "terminal_color_3", |
| 108 | + "terminal_color_4", |
| 109 | + "terminal_color_5", |
| 110 | + "terminal_color_6", |
| 111 | + "terminal_color_7", |
| 112 | + "terminal_color_8", |
| 113 | + "terminal_color_9", |
| 114 | + "terminal_color_10", |
| 115 | + "terminal_color_11", |
| 116 | + "terminal_color_12", |
| 117 | + "terminal_color_13", |
| 118 | + "terminal_color_14", |
| 119 | + "terminal_color_15", |
| 120 | + }, |
| 121 | + }) |
| 122 | +< |
| 123 | + |
| 124 | + |
| 125 | +RECOMMENDED SETTINGS |
| 126 | + |
| 127 | +>lua |
| 128 | + -- Please arrange the patterns for your favorite plugins by yourself. |
| 129 | + require("ex-colors").setup({ |
| 130 | + -- included_patterns = require("ex-colors").presets.recommended.included_patterns + { |
| 131 | + -- "^Cmp%u", -- hrsh7th/nvim-cmp |
| 132 | + -- '^GitSigns%u', -- lewis6991/gitsigns.nvim |
| 133 | + -- '^RainbowDelimiter%u', -- HiPhish/rainbow-delimiters.nvim |
| 134 | + -- }, |
| 135 | + autocmd_patterns = { |
| 136 | + CmdlineEnter = { |
| 137 | + ["*"] = { |
| 138 | + "^debug%u", |
| 139 | + "^health%u", |
| 140 | + }, |
| 141 | + }, |
| 142 | + -- FileType = { |
| 143 | + -- ['Telescope*'] = { |
| 144 | + -- '^Telescope%u', -- nvim-telescope/telescope.nvim |
| 145 | + -- }, |
| 146 | + -- }, |
| 147 | + }, |
| 148 | + }) |
| 149 | +< |
| 150 | + |
| 151 | + |
| 152 | +COMMANDS ~ |
| 153 | + |
| 154 | + |
| 155 | +:EXCOLORS[!] |
| 156 | + |
| 157 | +Generate a new colorscheme to the directory set in `colors_dir` option, and |
| 158 | +start `:edit`ing the output file for preview. |
| 159 | + |
| 160 | +The name will be determined as the current value of `g:colors_name` prefixed by |
| 161 | +_ex-_, e.g., _ex-habamax_ for _habamax_. |
| 162 | + |
| 163 | +With `!` appended, it will dump all the highlight definitions to the file |
| 164 | +`ex-{g:colors_name}.lua` (not saved), ignoring all the filter and modifier |
| 165 | +options. It is useful to know what you can get primarily, and, once committed |
| 166 | +in git, to know (not necessarily but with some git integration plugins like |
| 167 | +vim-fugitive <https://github/tpope/vim-fugitive>, gitsigns.nvim |
| 168 | +<https://github.com/lewis6991/gitsigns.nvim>, etc.) what definitions are |
| 169 | +filtered off, or converted. |
| 170 | + |
| 171 | +Please note that some colorscheme plugins provide multiple flavors sharing a |
| 172 | +single `g:colors_name` |
| 173 | + |
| 174 | +1. Givena colorscheme plugin _foobar.nvim_ which provides 3 flavors |
| 175 | +(_foobar-dark_, |
| 176 | +_foobar-light_, |
| 177 | +_foobar-dimmed_), |
| 178 | +but `g:colors_name` is set to `"foobar"` each. |
| 179 | +2. Execute `:colorscheme foobar-dark` anyhow in your vimrc. |
| 180 | +3. Execute `:ExColors` in Command-line mode. |
| 181 | +4. Then, the new colorscheme name generated by `ex-colors` could be |
| 182 | +not _ex-foobar-dark_, |
| 183 | +but _ex-foobar_. |
| 184 | + |
| 185 | + |
| 186 | +NOT IN PLAN *ex-colors-not-in-plan* |
| 187 | + |
| 188 | +Unlike general colorscheme plugins, the generated colorschemes expect the |
| 189 | +following usages: |
| 190 | + |
| 191 | +- NOT to be loaded after any other colorschemes, |
| 192 | +- NOT to be independent plugin repositories, |
| 193 | + |
| 194 | +however, |
| 195 | + |
| 196 | +- to be **loaded first** on your nvim startup. |
| 197 | +- to be **managed by yourself** in your dotfiles |
| 198 | + or any other repository for yourself. |
| 199 | + |
| 200 | +Because of the backgrounds above, `ex-colors.nvim` will NOT support the |
| 201 | +following features: |
| 202 | + |
| 203 | +- Byte-Compile |
| 204 | + To manage the output in version control system, |
| 205 | + byte codes are bad for human to compare diffs. |
| 206 | + Please enable `vim.loader`. It does instead. |
| 207 | +- `:highlight clear` and `:syntax reset` in the outputs |
| 208 | + They are only overheads on nvim startup. |
| 209 | + |
| 210 | +Generated by panvimdoc <https://github.com/kdheepak/panvimdoc> |
| 211 | + |
| 212 | +vim:tw=78:ts=8:noet:ft=help:norl: |
0 commit comments