Open gitaarik opened 6 months ago
You can apply markdown highlighting as detailed in the README, which will allow injecting code blocks https://github.com/rcarriga/nvim-notify/blob/5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15/README.md#L123-L129
Aha ok, yea I guess that's it, although I do see the backticks:
local text = [[
Test `g:my_cool_setting`
```lua
print('hi')
]]
vim.notify(text, "info", { title = "My Awesome Plugin", on_open = function(win) local buf = vim.api.nvim_win_get_buf(win) vim.api.nvim_buf_set_option(buf, "filetype", "markdown") end, })
And it would be nice if you could manually set styles. For example if I have a option that I can toggle on / off, I would like to have the text be green or red. I don't want to use the "error" log level for "off", because it's not an error.
It took me years to find this, and finally I found it.
you can
require "notify"({ "`a` does not exist.", "```python", "print(a)", "```" }, "info", {
title = "test",
on_open = function(win)
vim.wo[win].conceallevel = 3
vim.wo[win].concealcursor = "n"
vim.wo[win].spell = false
vim.treesitter.start(vim.api.nvim_win_get_buf(win), "markdown")
end,
})
This example image is used in the nvim-notify README.md:
I wonder how the
g:my_cool_setting
gets its orange color and how the code is highlighted. I wonder if it's possible to style text to give it a custom color make it bold or italic.