Skip to content

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

Answered by MunifTanjim
darzok0914 asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by MunifTanjim
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #76 on December 27, 2021 06:38.