Override filetypes that already exist in filetype.vim#1
Closed
edwintorok wants to merge 4 commits intoundu:ocaml_interfacefrom
Closed
Override filetypes that already exist in filetype.vim#1edwintorok wants to merge 4 commits intoundu:ocaml_interfacefrom
edwintorok wants to merge 4 commits intoundu:ocaml_interfacefrom
Conversation
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 <edwin@etorok.net>
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). |
Owner
|
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 :) |
c187037 to
e9b95e0
Compare
Author
|
There is a different way to solve this now that NeoVim has switched to using filetype.lua only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some OCaml filetypes already exist in NeoVim's filetype.vim/filetype.lua.
setfonly 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)