Skip to content

Commit

Permalink
feat: further customise highlight colors
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-nz committed May 23, 2024
1 parent 455f527 commit 1cdbde3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ return {
- `showBlankVirtLine = false`
Setting this option will mean that if a Virtual Line would be blank it wont be
rendered
- `highlightColor` can be a string or a highlight table. If it's a string, it
must be a valid highlight, see `:highlight`. It can also be a table that defines
a set of [highlight values](https://neovim.io/doc/user/api.html#nvim_set_hl()).


## ❔Usage

Expand Down
9 changes: 8 additions & 1 deletion lua/precognition/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local M = {}
---@class Precognition.PartialConfig
---@field startVisible? boolean
---@field showBlankVirtLine? boolean
---@field highlightColor? string
---@field highlightColor? string | vim.api.keyset.highlight
---@field hints? Precognition.HintConfig
---@field gutterHints? Precognition.GutterHintConfig

Expand Down Expand Up @@ -355,6 +355,13 @@ function M.setup(opts)

ns = vim.api.nvim_create_namespace("precognition")
au = vim.api.nvim_create_augroup("precognition", { clear = true })

if type(config.highlightColor) == "table" then
vim.api.nvim_set_hl(ns, "precognition", config.highlightColor)
vim.api.nvim_set_hl_ns(ns)
config.highlightColor = "precognition"
end

if config.startVisible then
M.show()
end
Expand Down

0 comments on commit 1cdbde3

Please sign in to comment.