diff --git a/README.md b/README.md index ae7a535..39d66b5 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,10 @@ - [Why another highlighter?](#why-another-highlighter) - [Customization](#customization) - [Updating color even when buffer is not focused](#updating-color-even-when-buffer-is-not-focused) + - [Testing](#testing) - [Extras](#extras) - [TODO](#todo) + - [Similar projects](#similar-projects) [![luadoc](https://img.shields.io/badge/luadoc-0.1-blue)](https://nvchad.com/nvim-colorizer.lua/) @@ -268,6 +270,18 @@ For lower level interface, see [LuaDocs for API details](https://nvchad.com/nvim-colorizer.lua/modules/colorizer.html) or use `:h colorizer` once installed. +## Testing + +To test colorization with your config, edit `test/expect.txt` to see expected +highlights + +For troubleshooting use `test/minimal.lua`. Edit the file to configure colorizer. +Run `minimal.lua` to startup neovim: + +```bash +nvim --clean -u minimal.lua expect.txt +``` + ## Extras Documentaion is generated using ldoc. See diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..0aec1c9 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +colorizer_issue/ diff --git a/test/expectation.txt b/test/expect.txt similarity index 100% rename from test/expectation.txt rename to test/expect.txt diff --git a/test/minimal.lua b/test/minimal.lua new file mode 100644 index 0000000..976a693 --- /dev/null +++ b/test/minimal.lua @@ -0,0 +1,38 @@ +-- Run this file as `nvim --clean -u minimal.lua expect.txt` + +for name, url in pairs({ + colorizer = "https://github.com/NvChad/nvim-colorizer.lua", +}) do + local install_path = vim.fn.fnamemodify("colorizer_issue/" .. name, ":p") + if vim.fn.isdirectory(install_path) == 0 then + vim.fn.system({ "git", "clone", "--depth=1", url, install_path }) + end + vim.opt.runtimepath:append(install_path) +end + +-- Configure setup opts +local opts = { + user_default_options = { + RGB = true, + RRGGBB = true, + names = true, + RRGGBBAA = true, + AARRGGBB = true, + rgb_fn = true, + hsl_fn = true, + css = true, + css_fn = true, + mode = "background", + tailwind = "lsp", + sass = { + enable = false, + parsers = { "css" }, + }, + virtualtext = "■", + }, + buftypes = { "!prompt", "!popup" }, + user_commands = true, +} +require("colorizer").setup(opts) + +-- ADD INIT.LUA SETTINGS _NECESSARY_ FOR REPRODUCING THE ISSUE