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

Override filetypes that already exist in filetype.vim #1

Open
wants to merge 4 commits into
base: ocaml_interface
Choose a base branch
from

Conversation

edwintorok
Copy link

Some OCaml filetypes already exist in NeoVim's filetype.vim/filetype.lua.
setf only sets the filetype if it is not already set.
Because filetype.vim already set the filetype for .mli/.mll/*.mly and
is loaded before this ftdetect plugin we have to override it using set ft.

This is 'solution A' from https://neovim.io/doc/user/filetype.html#new-filetype

The other filetypes are either new, or match what is already declared in
filetype.vim so no need for overrides there.

See also my comment at ocaml#61 (comment)

undu and others added 4 commits February 22, 2022 20:34
This is needed for supporting the tree-sitter parsers in ocaml because
the interface parser is different from the implementation one one.
Some OCaml filetypes already exist in NeoVim's filetype.vim/filetype.lua.
`setf` only sets the filetype if it is not already set.
Because filetype.vim already set the filetype for *.mli/*.mll/*.mly and
is loaded before this ftdetect plugin we have to override it using `set ft`.

This is 'solution A' from https://neovim.io/doc/user/filetype.html#new-filetype

The other filetypes are either new, or match what is already declared in
filetype.vim so no need for overrides there.

Signed-off-by: Edwin Török <[email protected]>
@edwintorok
Copy link
Author

I've only tested this on NeoVim. Based on my reading of http://vimdoc.sourceforge.net/htmldoc/filetype.html#new-filetype it should work on Vim too (scenario A is common between Vim and NeoVim).

@undu
Copy link
Owner

undu commented May 14, 2022

vim-ocaml regularly pushed to the vim and neovim repositories and serves as the default upstream. This means that the intention in these ftdectedt files is to be overriden by configurations, and this is why setf is being used, this follows the rest of filetypes in https://github.com/ocaml/vim-ocaml/tree/master/ftdetect

If something is overriding these they should be changed, let's see how open to this are the neovim people :)

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.

2 participants