andrewferrier / wrapping.nvim

Plugin to make it easier to switch between 'soft' and 'hard' line wrapping in NeoVim
MIT License
121 stars 4 forks source link

Add typst files to auto_set_mode_filetype_allowlist #42

Closed ruimp closed 7 months ago

ruimp commented 7 months ago

Typst is gaining some traction as a LaTeX alternative. It would be nice to add ".typ" files to the allow list. Thank you.

andrewferrier commented 7 months ago

Thanks - this is a good idea. However, from what I can see, NeoVim doesn't have a standard filetype for .typ files yet - unless you know otherwise? wrapping.nvim allowlists filetypes, not file extensions.

On Tue, 6 Feb 2024 at 11:29, ruimp @.***> wrote:

Typst is gaining some traction as a LaTeX alternative. It would be nice to add ".typ" files to the allow list. Thank you.

— Reply to this email directly, view it on GitHub https://github.com/andrewferrier/wrapping.nvim/issues/42, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2EB6EPFEN4ILPQWSL3U3YSIAYTAVCNFSM6AAAAABC3W5FWOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZDANBUGIZDEMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Andrew Ferrier @.***

ruimp commented 7 months ago

I don't really understand how this works. When I search :h filetype locally, I can't find a mention of filetype associated to ".typ". However, on the online documentation there is a mention to ".typ" filetypes in the list. Maybe it's being introduced? On my system it detect filetype "typst", but I use the plugin typst.nvim. Thanks for your work on this brilliant plugin.

andrewferrier commented 7 months ago

Hi, OK, so I looked into this. As of NeoVim 0.10+ (unreleased, so this is currently nightly-only), typst files are automatically supported; so I've added support for them to wrapping.nvim. This will only work out of the box on NeoVim 0.10+.

If you're using an earlier version of NeoVim, you should be able to add a typst filetype manually using this in your NeoVim config:

vim.filetype.add({
    extension = {
        typ = "typst"
    }
})