-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Refactored runtime/ftplugin/zig.vim, removed upstream comment, and removed aucmd and auto formatting support. #13803
Conversation
…and auto formatting support.
I believe autocmd that does autoformat should absolutely not happen by default. |
I would also avoid all
On windows gvim Should be either opt-in or just a ftplugin help entry on how to set up |
Is there a reason not to send your more general changes through the maintainer's repo? |
They might disagree with the proposed changes, but yeah it needs to be addressed there too(first?). PS, |
The general changes can be added to the zig.vim plugin after the fact, if they want them. And please note that I am only referring to |
Just as an example, the go ft plugin was split into two, one bare bones and one more ide-like. Edit: And again, the rust ftplugin implementation also has exactly the same problem as noted. We have merged a lot of special and opinionated support for rust fmt and cargo, which I don't believe should be a part of the vim runtime either. |
What is currently blocking this PR? Is it just the undocumented variable? |
yes |
@Tiseno could you please add the missing doc section? This is a blocking PR for neovim/neovim#28878 |
Here is a patch for the docs: diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index deb947cf1..feb946252 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -829,6 +829,12 @@ The mappings can be disabled with: >
let g:no_vim_maps = 1
+ZIG *ft-zig-plugin*
+
+ *g:zig_recommended_style*
+The Zig |ftplugin| sets options according to Zig's recommended style. This can
+be disabled by setting |g:zig_recommended_style| to 0.
+
+
ZIMBU *ft-zimbu-plugin*
The Zimbu filetype plugin defines mappings to move to the start and end of I put it in |
Thanks, makes sense. I'll have a look later today |
The doc comment! |
It is used to set the |
Ok, seems good to me, but is the implementation good enough?
But maybe we can leave that to another time. |
We don't need to shell out or call |
where is this |
@chrisbra The original implementation (upstream) has a |
Ah, okay, let's leave it out for now. I am not a big fan of running system commands just by loading a filetype. Just document that |
Specifically, the |
Now I just declared that one can put it in a aucmd, and linked to aucmd, but do we want a full example for that instead? |
thanks all! |
runtime(zig): refactor zig ftplugin, remove auto format Refactored zig ftplugin, removed upstream comment, aucmd and auto formatting support. Updated documentation for zig configuration settings and added new maintainer. closes: vim/vim#13803 vim/vim@d1d9316 Co-authored-by: Tiseno <mathias.lindgren@stabelo.se>
…ormat Refactored zig ftplugin, removed upstream comment, aucmd and auto formatting support. Updated documentation for zig configuration settings and added new maintainer. closes: vim/vim#13803 vim/vim@d1d9316 Co-authored-by: Tiseno <mathias.lindgren@stabelo.se>
…ormat (#28904) Refactored zig ftplugin, removed upstream comment, aucmd and auto formatting support. Updated documentation for zig configuration settings and added new maintainer. closes: vim/vim#13803 vim/vim@d1d9316 Co-authored-by: Tiseno <mathias.lindgren@stabelo.se>
https://github.com/ziglang/zig.vim added auto formatting and linting (and population of the qflist) on save as a aucmd with an opt-out configuration, and was then merged into vim runtime. This seems to me like something that should be left up to that plugin and not be a part of vim.
It should probably be:
opt-in, as it is very unexpected behavior and uncharacteristic of vim to do something like this automatically
or removed entirely, as it should be left up to the user to register that kind of behavior if they want it through a plugin.
This PR does the latter.
I could not find any concrete guidelines of what built in file type plugins should and should not do, I am personally fine with whatever, opt-in, or remove the format/astcheck functionality. But in any case I think it should not register any aucmds by default without opting in to it (i.e. the check for opt in should be for registering the aucmd, not for running the formatter or not). I have noted that the rust filetype support also has a lot of options available as opt-in, and it also always registers an aucmd.
Is this the direction vim is moving in? i.e. upstreaming oppinionated plugins for integrating languages tightly?
My expectation before going down this rabbit hole was that built-in language supports only provided: filetype, filetype detection, syntax, indentation, and a makeprg.
The
zig.vim
plugin wants to be an ide-like plugin, and this PR removes the upstream dependency for the ftplugin implementation. I also made some consistency changes to the code in how undo_ftplugin is handled and added thezig_recommended_style
as consistent with other ftplugins. The only significant thing left is the g:zig_std_dir/path and execution of zig env, which might also be up for discussion if it should be removed.