Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to use hlgroups in a notify call, or otherwise colorize things ad hoc? #230

Open
prurph opened this issue Nov 18, 2023 · 1 comment

Comments

@prurph
Copy link

prurph commented Nov 18, 2023

I'd like to create a notification that uses hlgroups to highlight various lines of hardcoded text, something like:

require("notify")("Some default text %#Error# these words have the Error hlgroup")

as a quick and dirty way to format different words in a notification ad hoc. My use case is I want to bind a popup that will remind me what some icons in my file explorer mean, and it would be cool if I could color each with their specific hlgroup, or even just match the correct color somehow. The notification text would be hardcoded.

Is this possible? Thanks!

Wouldn't it be cool if these were each colored appropriately!? 💅

Screenshot 2023-11-18 at 1 06 52 PM
@prurph
Copy link
Author

prurph commented Nov 19, 2023

As a hack I can create a scratch buffer that looks like I want and then replace the notify buffer in the on_open, but that destroys the title of the notification. I tried to capture the notification lines by using vim.api.nvim_buf_get_lines on the notification buffer before I replaced it, but that didn't work either.

Is there a way to provide a buffer to use as the notification body? Unfortunately passing just the lines of the buffer (from vim.api.nvim_buf_get_lines) discards any highlighting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant