Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to set fileype for nui.popup (to get syntax highlighting)? #76

Closed
darzok0914 opened this issue Dec 27, 2021 · 1 comment
Closed

Comments

@darzok0914
Copy link

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 ?

@MunifTanjim
Copy link
Owner

So, filetype is just a buffer option (check :help 'filetype'). You can do this to set it:

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.

@MunifTanjim MunifTanjim changed the title allowing file type for nui.popup to get tree sitter highlighting How to set fileype for nui.popup (to get syntax highlighting)? Dec 27, 2021
Repository owner locked and limited conversation to collaborators Dec 27, 2021
@MunifTanjim MunifTanjim converted this issue into discussion #77 Dec 27, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants