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
Convert remaining core runtime support files to Vim9 script #13039
base: master
Are you sure you want to change the base?
Convert remaining core runtime support files to Vim9 script #13039
Conversation
a880187
to
9f02a2f
Compare
Codecov Report
@@ Coverage Diff @@
## master #13039 +/- ##
==========================================
+ Coverage 81.43% 82.08% +0.65%
==========================================
Files 160 160
Lines 194844 194945 +101
Branches 43727 43753 +26
==========================================
+ Hits 158666 160017 +1351
+ Misses 23422 22061 -1361
- Partials 12756 12867 +111
Flags with carried forward coverage won't be shown. Click here to find out more. |
Good God, why? Why make some of these core files hard to read unless one knows vim9script? Why screw up git-blame? To save a billionth of a second? And for the files where the only thing changed is the comment character: why? There's not even the negligible benefit to speed there. Please, leave the runtime files alone. Vim9script is for people with mega-fancy plugins. It should not be polluting runtime. |
|
||
" Bail out when a FileType autocommand has already set the filetype. | ||
import "./autoload/dist/script.vim" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import autoload dist/script.vim
" Maintainer: The Vim Project <https://github.com/vim/vim> | ||
" Last Change: 2023 Aug 27 | ||
" Former Maintainer: Bram Moolenaar <Bram@vim.org> | ||
vim9script noclear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noclear? seems you're using g: var
" Maintainer: The Vim Project <https://github.com/vim/vim> | ||
" Last Change: 2023 Aug 10 | ||
" Former Maintainer: Bram Moolenaar <Bram@vim.org> | ||
vim9script noclear |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noclear? seems you're using g: var
Funnily enough, and since you ask in such a melodramatic manner, because god himself asked me to and who are you or I to question the word of god?
You must be a fan of line continuation and command separator characters. Each to their own but I'm going to call bullshit on this question.
I've had no trouble tracking the history of other converted files when the need arose. The obsession with prioritising the output of a VCS tool over the actual code is asinine.
No, to normalise on the latest version of the language which also brings other benefits besides performance improvements.
Now a change in comment characters is too much for you? Companion runtime files using different versions of the language so as not to change the comment character seems totally reasonable.
We're not torturing kittens here.
According to who? Certainly not the author of the language or program. It's not referred to as "legacy script" for nothing.
It's polluting the purity of the runtime now? This pathological disdain for Vim9 script is one of the strangest things I've ever seen. You survived the horrors of having runtime/autoload/dist/{script,ft}.vim and others converted eighteen months ago. You survived the winter of our discontent after just the comments and a variable prefix were changed when converting runtime/ftplugof.vim. You will survive this too. Just be thankful you're, presumably, not a NeoVim user. They rewrote all the filetype detection code in Lua! Won't anyone think of the git-blame output? P.S. Converting optwin.vim actually found a couple of 'bugs'. Damn those static types - you can't live with them, you can't live without them. |
Thanks @Shane-XB-Qian - will update when I'm next working on it. |
Yes, and for a very good reason. We did not just convert from one language to another but rewrote the whole shindig from scratch to avoid creating a thousand autocommands, for significant performance improvements. You might wish to look into doing the same (in vim9script, of course). |
it's not only about performance. writing legacy vimscript can be rather messy and has several pitfalls (see the various restrictions introduce by For that reason in addition to the explicit typing rules will give us several benfefits: easier readable scripts + preventing ambigious situtations (which may lead to subtle and hard to find bugs) and those are therefore in my opinion valid reasons to rewrite existing scripts using Vim9. BTW, I don't believe that vim9 script is harder to read than existing vimscript. I think if you understand vimscript, you will be capable of reading vim9 script as well. However, I am a bit worried about Neovim compatibility. Not sure if they would be affected by this or if they are already using their own lua implementation for those scripts. If yes, that would be a reason not do convert those scripts. If not, I don't see a reason not to do so (considering that someone is willing to do the work, which apparently people are ;) ) |
That is much appreciated :)
We would definitely be affected, but not hugely so -- we already have diverged for the whole filetype.vim family (see above; partly triggered by vim9 rewrites), and the remaining files are small and effectively frozen. (That's how we deal with such files: effectively freeze them at the point before the rewrite, and manually backport changes if they seem worth it. So it does add a modicum of friction for us.) The |
I spoke to Bram, at some length, about this prior to the Vim 9 release. I offered to convert everything (including my user maintained files) to give Vim9 script a flying start on release but we agreed not to do that and to not heavily advocate for conversions in order that you could work out a solution at your end. I was following TJ's compiler that seemed to be making good progress; is that not usable yet? I don't follow closely, but it appears you're not including some of the more recent Vim9-script runtime file additions like I don't know what the solution is but I have a lot of stuff batched up in my repo that's been waiting for a green light. I wouldn't write anything in legacy script again if given the choice and it makes absolutely no sense to have performance intensive indent scripts, for example, in legacy script. I'm concerned that Vim9 script is in danger of becoming a white elephant if it doesn't see increased adoption in the near future which would, I think, be a great shame. |
It's usable, but not to the point where it can convert arbitrary vim9script (which is still a bit of a moving target) yet. We've tested it with
That is correct. We do not port vim9script filetype plugins (yet); any rewrite means the plugin remains frozen at the pre-rewrite (for now). We also do not see much point in rewriting these in Lua, as Vimscript Classic is a perfectly fine DSL for that purpose.
Thank you for the heads-up. If a concerted push to rewrite the Vim runtime in Vim9script is coming, we will need to consider our options sooner rather than later. (It would be a shame, but freezing files is a solution, especially for languages with a serviceable tree-sitter parser.) |
(Just to be clear: I am not campaigning for you to hold off on anything here; I'm just providing context that was asked for and showing my -- genuine -- appreciation for the consideration, which is not a given.) |
This is just some grunt work I committed to some time ago...
It's probably not appropriate for 9.1.