How to set fileype for nui.popup (to get syntax highlighting)? #77
-
Hi, I think everything is in the title, it would be great if we could use the popup window to display some code for instance. it would be nice to get the color highlighting from tree sitter by being able to associate a file type to the popup window, I went though the documentation and didn't see anything like this ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
So, local popup = Popup({
...
buf_options = {
...
filetype = "lua",
},
...
}) or vim.api.nvim_buf_set_option(popup.bufnr, "filetype", "lua") Either of them will do the trick. |
Beta Was this translation helpful? Give feedback.
-
thanks for your response, it did the trick indeed :) |
Beta Was this translation helpful? Give feedback.
So,
filetype
is just a buffer option (check:help 'filetype'
). You can do this to set it:or
Either of them will do the trick.