From 5d32edf89793f55e5da02d0e4bcfacae0e5e6838 Mon Sep 17 00:00:00 2001 From: Meow Honk <21010072+catgoose@users.noreply.github.com> Date: Tue, 19 Nov 2024 07:14:03 -0600 Subject: [PATCH] Docs/Add lazy.nvim example (#99) * chore: adds scripts/start_minimal.sh script * ref: updates luadoc to accept nil for setup opts * doc: updates readme to add lazy.nvim setup example --- README.md | 41 ++++++++++++++++++++++++++++++++------ doc/colorizer.txt | 2 +- doc/modules/colorizer.html | 2 +- lua/colorizer.lua | 2 +- scripts/start_minimal.sh | 4 ++++ 5 files changed, 42 insertions(+), 9 deletions(-) create mode 100755 scripts/start_minimal.sh diff --git a/README.md b/README.md index 39d66b5..1cffcb4 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,12 @@ - [colorizer.lua](#colorizerlua) - [Installation and Usage](#installation-and-usage) - - [Use with commands](#use-with-commands) - - [Use from lua](#use-from-lua) + - [Plugin managers](#plugin-managers) + - [Lazy.nvim](#lazynvim) + - [Packer](#packer) + - [Manual](#manual) + - [User commands](#user-commands) + - [Lua API](#lua-api) - [Why another highlighter?](#why-another-highlighter) - [Customization](#customization) - [Updating color even when buffer is not focused](#updating-color-even-when-buffer-is-not-focused) @@ -20,6 +24,9 @@ A high-performance color highlighter for Neovim which has **no external dependencies**! Written in performant Luajit. +As long as you have `malloc()` and `free()` on your system, this will work. +Which includes Linux, OSX, and Windows. + ![Demo.gif](https://raw.githubusercontent.com/norcalli/github-assets/master/nvim-colorizer.lua-demo-short.gif) ## Installation and Usage @@ -30,12 +37,26 @@ unsure, [read this excellent guide](https://github.com/termstandard/colors). Use your plugin manager or clone directly into your package. +### Plugin managers + +#### Lazy.nvim + +```lua +{ + "NvChad/nvim-colorizer.lua", + event = "BufReadPre", + opts = { -- setup opts + }, +} +``` + +#### Packer + ```lua use("NvChad/nvim-colorizer.lua") ``` -As long as you have `malloc()` and `free()` on your system, this will work. -Which includes Linux, OSX, and Windows. +#### Manual One line setup. This will create an `autocmd` for `FileType *` to highlight every filetype. @@ -46,7 +67,7 @@ every filetype. require("colorizer").setup() ``` -### Use with commands +### User commands | Command | Description | | ----------------------------- | ----------------------------------------------------------- | @@ -55,7 +76,7 @@ require("colorizer").setup() | **ColorizerReloadAllBuffers** | Reload all buffers that are being highlighted currently | | **ColorizerToggle** | Toggle highlighting of the current buffer | -### Use from lua +### Lua API ```lua -- All options that can be passed to `user_default_options` in setup() can be @@ -282,6 +303,12 @@ Run `minimal.lua` to startup neovim: nvim --clean -u minimal.lua expect.txt ``` +Also there is a script that you can run from the root of the repo: + +```bash +scripts/start_minimal.sh +``` + ## Extras Documentaion is generated using ldoc. See @@ -292,6 +319,8 @@ Documentaion is generated using ldoc. See - [ ] Add more color types ( var, advanced css functions ) - [ ] Add more display modes. E.g - sign column - [ ] Use a more space efficient trie implementation. +- [ ] Support custom parsers +- [ ] Allow custom color names ## Similar projects diff --git a/doc/colorizer.txt b/doc/colorizer.txt index 57213f5..4b4fb8a 100644 --- a/doc/colorizer.txt +++ b/doc/colorizer.txt @@ -195,7 +195,7 @@ setup({opts}) *colorizer.setup* Parameters: ~ - {opts} - table: User provided options + {opts} - table|nil: User provided options See also:~ |colorizer.config| diff --git a/doc/modules/colorizer.html b/doc/modules/colorizer.html index 351d159..6a750c9 100644 --- a/doc/modules/colorizer.html +++ b/doc/modules/colorizer.html @@ -363,7 +363,7 @@