Modernize Vim plugin for Macaulay2#4364
Conversation
Restructure the vim/ directory as a standard Vim plugin layout (ftdetect/, ftplugin/, syntax/, dict/) so files can be installed by copying directly without renaming. Replace the screen/AppleScript-based M2 integration with Vim's built-in terminal (term_start/term_sendkeys, requires Vim 8.1+), eliminating the dependencies on screen, Terminal.app, and VimM2.scpt. Merge the two platform-specific READMEs into a single README.md and update the installation instructions. Update CMakeLists.txt and make-M2-symbols.m2 to generate files at their new paths (vim/syntax/m2.vim, vim/dict/m2.vim.dict). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Would it make sense to allow a "Vim person" to modernize the plugin so that they can take ownership and maintain it going forward? e.g. the people who worked on it at the workshop? |
|
This is a distinct plugin (vim v. neovim), but I'll mention something in Zulip. I did add a link to the neovim plugin repo in the README |
|
why have you checked in |
|
It is, but this way users don't need to regenerate it themselves |
|
For what it's worth, the reason I mentioned it's better to have a Vim person take ownership is that dropping a Claude generated plugin on someone to maintain is burdening them with technical debt that they didn't ask for, which I don't think is fair even if they themselves would use AI to generate a plugin. In the end I'm not going to be using it so it's up to the people who would to decide if they want this or not. |
only if you consider the github repo as a distribution source. But once you start adding build artefacts into the repo, there is way too much generated junk which starts polluting the repo with frequently updated largish files, starts creating annoying merge conflicts, etc. |
|
There is also nothing on how all these files are generated. I don't see anything besides in |
We do generate the vim grammar, and the textmate grammar now lives in the vscode-macaulay2 repository.
|
Nice catch! That The magic incantation is in I suppose we could remove the generated files from git and add the |
|
Yes, please, this would be great |
| needsPackage "Style" | ||
| changeDirectory "~/.vim" | ||
| generateGrammar("dict/m2.vim.dict", demark_" ") | ||
| generateGrammar("syntax/m2.vim", demark_" ") |
There was a problem hiding this comment.
Can we, instead for copying templates to ~/.vim/, keep them in the M2 sources dir?
Then we would only need to cp -r ftdetect ftplugin ~/.vim/.
I'd do the latter with copyDirectory, and wrap the whole thing in a small M2 function installVimPlugin of something like this.
This can be done in another PR, though, if you prefer.
There was a problem hiding this comment.
Yeah, that makes sense. Another PR sounds good. Should we merge this and you can start from there?
There was a problem hiding this comment.
ok. By the way, how does one navigate M2 source tree from M2? I presume there's some build-in for the root of it?
There was a problem hiding this comment.
If you're running from a just-built copy of M2, then topSrcdir tells you the root directory. It's unexported, so you have to debug Core or importFrom(Core, "topSrcdir"). It's just null when running in a distributed copy of M2.
Restructure the vim/ directory as a standard Vim plugin layout (ftdetect/, ftplugin/, syntax/, dict/) so files can be installed by copying directly without renaming.
Replace the screen/AppleScript-based M2 integration with Vim's built-in terminal (term_start/term_sendkeys, requires Vim 8.1+), eliminating the dependencies on screen, Terminal.app, and VimM2.scpt.
Merge the two platform-specific READMEs into a single README.md and update the installation instructions.
Update CMakeLists.txt and make-M2-symbols.m2 to generate files at their new paths (vim/syntax/m2.vim, vim/dict/m2.vim.dict).
AI Disclosure
This was all Claude. I'm an Emacs guy and wouldn't know where to begin. But I tested it out and it works!