Open gegoune opened 2 years ago
This theme uses an internal method:
Suppose this ideally should be copied into this repo because it's marked as private, hence no guarantee to keep working in later releases :)
So it uses vim.cmd
, that makes sense. I think I could try to give PR implementing vim.api.nvim_set_hl()
a go.
To use the current (i.e. 0.6.1) nvim_set_hl
signature you can just do this:
local ns = vim.api.nvim_create_namespace('nordic')
vim.api.nvim_set_hl(ns, ...)
Not really sure if it's worth supporting the 0
argument value until it hits a release, because currently this needs a vim.has()
and some condition for backwards compatibility :thinking:
vim.version().minor >= 7
should work as well.
And I am not sure if using nordic
namespace would apply global highlight, would it?
I believe it will work exactly the same. The 0
argument is just a way to eliminate the need to create your own ns.
Unless I am doing something wrong I am getting different results depending on whether 0
or custom namespace
is used. It works with 0
but not with ns
.
I see. I'm not familiar with this specific highlighting function, but in hindsight that makes sense... it's the same for virtual text which I've used extensively in another plugin I work on. Derp!
I am working on some refactor to nordic to work with that new interface. Will get it to working state and open PR.
Since vim.highlight.create
now emits a deprecation warning on main neovim branch, I added basic support for the new API.
https://github.com/andersevenrud/nordic.nvim/commit/eb096c03853b8cc24457263c9ceed90256566118
With https://github.com/neovim/neovim/commit/4aa0cdd3aa117e032325edeb755107acd4ecbf84 merged in it is possible now to use
vim.api.nvim_set_hl(0, …)
to set highlights for global:highlight
namespace.I have noticed in nordic's code that you are using
vim.highlight.create
but couldn't find it in documentation. What is it?