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

feat(ft): add twig support #249

Merged
merged 3 commits into from Sep 30, 2022
Merged

feat(ft): add twig support #249

merged 3 commits into from Sep 30, 2022

Conversation

gbprod
Copy link
Contributor

@gbprod gbprod commented Sep 29, 2022

@numToStr
Copy link
Owner

numToStr commented Sep 29, 2022

Is html.twig set by nvim? And what about syntax highlighting?

Edit: I am only able to find setf=twig https://github.com/neovim/neovim/blob/9ca313fb968448011aae0509e6552c52b9f8aa8c/runtime/filetype.vim#L2094

@gbprod
Copy link
Contributor Author

gbprod commented Sep 29, 2022

When I open twig files (without any plugins), neovim set html.twig as filetype. I can't find why looking at Nevim source code...
If I set twigas filetype in ft.lua, it doesn't work at all.

Currently, I use commentstring to make your plugin works on twig files.

Syntax highlight doesn't work without plugins in Neovim but I've made a PR that still not merged to implements treesitter for twig files.

@numToStr
Copy link
Owner

numToStr commented Sep 29, 2022

When I open twig files (without any plugins), neovim set html.twig as filetype.

Interesting, can you try it with nvim --clean? I am just curious as I can't find any reference of html.twig source code and I certainly don't want to add wrong filetype. See #249 (comment)

Syntax highlight doesn't work without plugins in Neovim but I've made a PR that still not merged to implements treesitter for twig files.

Nice 👍

@numToStr
Copy link
Owner

numToStr commented Sep 29, 2022

So, I checked it myself, by default nvim --clean foo.twig sets filetype to twig but there is no highlighting but setting html.twig I get highlighting only on html tags.

Left: set ft=twig | Right: set ft=html.twig

image

@gbprod
Copy link
Contributor Author

gbprod commented Sep 29, 2022

Thanks for the feedback, I've also checked and I found that it's vim-polyglot who set html.twig as filetype. I'll update my code tomorrow!

lua/Comment/ft.lua Outdated Show resolved Hide resolved
lua/Comment/ft.lua Outdated Show resolved Hide resolved
lua/Comment/ft.lua Outdated Show resolved Hide resolved
@numToStr numToStr merged commit d9cfae1 into numToStr:master Sep 30, 2022
@gbprod gbprod deleted the feat-twig branch September 30, 2022 08:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants