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

[Feature request] syntax highlighting in file preview #36

Closed
registerGen opened this issue Jan 23, 2022 · 3 comments
Closed

[Feature request] syntax highlighting in file preview #36

registerGen opened this issue Jan 23, 2022 · 3 comments

Comments

@registerGen
Copy link
Contributor

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.

@registerGen
Copy link
Contributor Author

Of course we can also change the code in nvim-cmp so that this issue can be closed right after that.

@hrsh7th
Copy link
Owner

hrsh7th commented Jan 23, 2022

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.

@registerGen
Copy link
Contributor Author

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.

hrsh7th added a commit that referenced this issue Jun 29, 2022
feat: syntax highlighting in preview (#36)
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

2 participants