-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add Option to Override Filetypes #14
Comments
Update: Apparently I have a competing plugin installed, which sets the filetype: I'll investigate further with that plugin disabled. |
I get a filetype of Initial thoughts: our plugin bails out if any filetype has already been set. We could qualify that behavior to take over anyway if the extension is |
Okay, this tells us that we did something wrong with regards to the detection of filetypes. I suspect that the following code snippet does not work as we expect it to. au! BufWrite,BufNewFile *.go.tmpl setfiletype yagpdbcc As far as I aware, the issue lies within the double extension. vim-go circumvents this issue by triggering on just
I agree, such a configuration variable could be useful. However, there are a plethora of other plugins out there, and as far as I am aware, none of them do something similar. Thus I am currently kind of reluctant to implement such a configuration, simply because it seems to go against the general consensus. |
*.go.tmpl
file extensions
Hm, interesting point about consensus there. I'm aware of other plugins ( Relatedly, what happens if we claim an extension that other plugins also claim? If they're loaded first, our plugin will bail out (as we've established), but what determines that loading order? We want to make sure we have reliable behavior, of course. |
Honestly, not quite sure about that. My first guess would be the order they're added to the runtime path, with the last one taking precedence. I'd have to investigate. |
This commit adds a configuration variable to override a detected filetype for certain extensions which are also used in the context of writing yagpdb custom commands. Closes #14
* ftdetect: add override capabilities This commit adds a configuration variable to override a detected filetype for certain extensions which are also used in the context of writing yagpdb custom commands. Closes #14 * editorconfig: set max text width All files except markdown files should not exceed 80 characters per line, for legacy /specification reasons. Markdown files should not exceed 120 characters. * all: consistent file naming There was one inconsistency with regards to the file naming within this repository -- we named files/folders with yagpdbcc, however this file was named yagpdb. This commit fixes that. * ftdetect: fix spacing issues, clarify usage in README * ftdetect: remove an improper `did_load_filetypes` check Co-authored-by: Lucas Ritzdorf <42657792+LRitzdorf@users.noreply.github.com>
Expected Behaviour
When entering NVim with a
*.go.tmpl
file, it is expected that the plugin changes the filetype toyagpdbcc
, thus granting syntax highlighting.Actual Behaviour
Instead, the filetype remains on
gohtmltmpl
, which seems to be set by (Neo)vim itself.Steps to Reproduce
(Make sure the plugin is loaded already or loads on-demand)
See
ft=gohtmltmpl
instead offt=yagpdbcc
.Additional Context
I'm not entirely sure where to begin troubleshooting -- I suspect the double extension is throwing our code off.
Code of Conduct
The text was updated successfully, but these errors were encountered: