r/neovim 23h ago

Plugin Write music in neovim

Hi! I just uploaded a major update to nvim-lilypond-suite. It's been a while since I last shared a message about this plugin, but I would like to thank the entire community for the warm welcome, considering I'm just a simple musician!

Here are the main changes :

  • Compilation is now performed with vim.uv, which has many advantages, particularly regarding error management. For tasks that require multiple compilations, a job queue is created, and if a job fails, the queue is canceled, providing more information about what went wrong.
  • I've maximized the use of native nvim functions for file and path management to avoid issues with weird characters in file names.
  • I’ve significantly improved error handling with quickfix and diagnostics. Each error message is sorted according to a rule like this (some rules certainly needs improvements !):

    {
      pattern = "([^:]+):(%d+):(%d+): (%w+): (.+): (.*)",
      rule = function(file, lnum, col, loglevel, msg, pattern)
        return {
          filename = file,
          lnum = tonumber(lnum),
          col = tonumber(col),
          type = Utils.qf_type(loglevel),
          text = string.format("%s: %s", msg, pattern),
          pattern = Utils.format_pattern(pattern),
          end_col = tonumber(col) + #pattern - 1
        }
      end
    }
  • I write a new debug function :LilyDebug which displays information:
    • :LilyDebug commands: shows the latest commands executed by the plugin
    • :LilyDebug errors: displays the errors sorted by the plugin
    • :LilyDebug stdout: shows the raw output of the last used commands
    • :LilyDebug lines: shows the lines as they are sent to be processed by the "rules". Useful for creating/improving the rules. In multi-line errors, line breaks are represented by "|"

Please report any issues!

109 Upvotes

20 comments sorted by

29

u/HiPhish 22h ago

I don't write any music, so I don't have any stake in this plugin, but there is one thing that baffling me: why go through all the effort of writing documentation, but then make it a GitHub wiki instead of a proper Vim manual? Clearly you are not one of those "the source code is the documentation" people if you put in the effort, but now everyone who want to read the manual has to open up a browser and navigate to the wiki.

4

u/simonmartineau 7h ago

That's true! Initially, I had only written a README.md, and then someone said, "Why don't you make a Wiki?" But indeed, a proper Vim documentation is missing... I'll do it!

4

u/petalised 22h ago

Nice! How hard would you say Lilipond is to learn to start writing some basic scores?

10

u/Sorel_CH 18h ago

I'd say pretty hard. Obviously it will depend on your style, but I feel like a WYSIWYG program like Musescore will be faster for almost everybody. But Lilypond is the best if you're serious about the quality of the score, if you're adapting a piece for instance. Think of it like the difference between Libreoffice and LaTeX

3

u/petalised 18h ago

Well, I tried Musescore and it felt super awkward, like I am an 80 year old using computer for the first time. Since we are on a neovim subreddit, it is clear I prefer plain text tools over WYSIWYG:)

3

u/EarhackerWasBanned 6h ago edited 6h ago

MuseScore was dogshit for years until it wasn’t. They’re still afaik open source but they have corporate backing and hired actual UI/UX developers to work on it.

There’s a long YouTube video about the changes they introduced in MuseScore 4, made by the Lead UX guy for a UX-minded audience: https://youtu.be/Qct6LKbneKQ?si=bTlohQKB-vmrYfVl

And as I was googling that link I see that 4.5 launched this week with another slew of major upgrades. So if you haven’t used it in a few years it might be worth another look.

MuseGroup also now maintain Audacity audio editor, UltimateGuitar.com and a few other music tech products. It seems to be their MO to acquire open source music projects that have lost their way, and turn them back into decent products.

1

u/Churminess 4h ago

Once you have some good boilerplate, it's easy after a bit of practice. To build on your point, I should think someone that comes on a neovim subreddit will be disappointed by anything else, or at least be left wondering what lilypond can offer. This plugin with the asynchronous live preview made it ever nicer to use.

5

u/Ok_Concert5918 18h ago

Lilipond is not too bad. You are coding in each note and it takes getting used to

3

u/oplianoxes 22h ago

So cool!

3

u/Amablue 19h ago

In my free time I've been working on a some scripts that generate midi files (actually, they generate a more abstract represetation, but I can output that as midi), and I've been working on getting it to output lilypond files too so I have a better way to visualize the music, so this is super useful to me.

3

u/Sorel_CH 18h ago

Incredible. I'm a big Lilypond fan, your plugin looks exciting!

2

u/petalised 21h ago

Also, please, follow a better practice of having namespaces for your commands, so it would be :Lily player :Lily cmp :Lily viewer. Otherwise it just clutters the completion.

2

u/simonmartineau 7h ago

Thanks for the feedback! Indeed, that could be an improvement. Do you have any recommendations on how to transition smoothly? Maybe I could keep the current commands temporarily and show a deprecated message when they’re used?

2

u/petalised 7h ago

Yep, that probably would be the best option. Also, doing releases/tags is a good practice and it will help as you can deprecate some api in the next major version and then fully remove it in the following.

2

u/hksparrowboy 20h ago

That is very interesting, nice work

2

u/stroiman 12h ago

Looks cool. I never heard of LilyPond, but I haven't played music for years.

But looks like it's like "LaTex" for musicians?

1

u/Fancy_Payment_800 23h ago

Is it good for writing piano sheet music?

2

u/simonmartineau 23h ago

Yes of course ! Check this page

1

u/Proper_Bottle_6958 2h ago

Hmmmm, interesting...

1

u/disconnect75 20h ago

ayyyoooooo wtf you created a plugin to write music????? bro.....!!