Closed registerGen closed 2 years ago
Of course we can also change the code in nvim-cmp so that this issue can be closed right after that.
I don't want to create new pseudo buffer (it has big side effect). I'm expecting to able to use the vim.filetype API but it would'nt usavle at the moment.
I'm expecting to able to use the vim.filetype API but it would'nt usavle at the moment.
Yes you are right. It doesn't have a function that can return the &ft
by giving it the file name.
And I also viewed the code and came up with a naive idea to implement this.
Since the
&ft
of preview window is always markdown, so we can't change&ft
(am I right?). But the preview content is actually a markdown code block, so we can make use of that.Create a new buffer which is named after the file name, check the
&ft
of that buffer, and delete that buffer. The&ft
is what we want.Note: for some unknown reason, treesitter highlight is not available, but the regex-based highlight is loaded.
A better solution is greatly appreciated.