An open API service indexing awesome lists of open source software.

https://github.com/martineausimon/nvim-lilypond-suite

Neovim plugin for writing LilyPond scores, with asynchronous make, midi/mp3 player, fast syntax highlighting, "hyphenation" function, and support for LaTex and Texinfo files
https://github.com/martineausimon/nvim-lilypond-suite

asynchronous audio-player ftplugin hyphenation hyphenation-rules latex lilypond lilypond-book lua lyluatex lyrics neovim syntax texinfo

Last synced: about 1 month ago
JSON representation

Neovim plugin for writing LilyPond scores, with asynchronous make, midi/mp3 player, fast syntax highlighting, "hyphenation" function, and support for LaTex and Texinfo files

Awesome Lists containing this project

README

        

# nvim-lilypond-suite

This is a plugin ([Neovim](https://github.com/neovim/neovim) only) for writing [LilyPond](https://lilypond.org/index.html) scores, with asynchronous make, midi/MP3 player, "hyphenation" function for lyrics, fast syntax highlighting... This repository also contains ftplugin files for **LaTeX** and **Texinfo** files which allows embedded LilyPond syntax highlighting, and makeprg which support `lilypond-book` or `lyluatex` package out of the box.


InstallationConfigurationUsageTips & tricks

---

> [!Important]
>I just uploaded the most important update since the creation of this plugin (commit [65dd9c0](https://github.com/martineausimon/nvim-lilypond-suite/commit/65dd9c0ce18bfc2990a309ddf253ac2f58e9ca62). I hope it won't cause any issues for you!

MAIN CHANGES MARCH 2025 (click to expand)

* 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 !):

```lua
{
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, 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 "|"
* `:LilyDebug stdout`: shows the raw output of the last used commands
* `:LilyDebug fileinfos`: shows the main file, main folder, output file, tmp folder used for compilation, and audio file if lilypond

Please report any issues!

## FEATURES

* **Fast syntax file for LilyPond**
* **Asynchronous :make** - compile in background without freezing Neovim
* **Audio player in floating window** (LilyPond only) - convert (mp3 or wav) and play midi file while writing score (using `mpv`, `timidity` or `fluidsynth` & `ffmpeg`)
* **QuickPlayer** (LilyPond only) - convert and play only visual selection
* **Hyphenation** : automatically place hyphens ' **--** ' inside texts to make those texts usable as lyrics (LilyPond only)
* **Simple ftplugin for LilyPond** with `makeprg`
* **Multiple files support** - Compile only main file when working on multiple files project
* **ftplugin for LaTex and Texinfo files** which detects and allows embedded LilyPond syntax, adaptive compilation function for `lyluatex` or `lilypond-book`
* **Easy auto-completion and Point & Click configuration**
* **Error managment** with correct quickfix and diagnostics



## QUICK INSTALL

> **⚠ This plugin requires Nvim >= 0.7**

If you want to use all the functions (player, hyphenation for various languages...), please read the [installation section](https://github.com/martineausimon/nvim-lilypond-suite/wiki/1.-Installation) in the wiki to install dependencies

### [lazy.nvim](https://github.com/folke/lazy.nvim)

```lua
{
'martineausimon/nvim-lilypond-suite',
opts = {
-- edit config here (see "Customize default settings" in wiki)
}
}
```

> Non lazy.nvim users : this plugin needs require('nvls').setup()

With config (click to expand)

```lua
{
'martineausimon/nvim-lilypond-suite',
opts = {
lilypond = {
mappings = {
player = "",
compile = "",
open_pdf = "",
switch_buffers = "",
insert_version = "",
hyphenation = "",
hyphenation_change_lang = "",
insert_hyphen = "ih",
add_hyphen = "ah",
del_next_hyphen = "dh",
del_prev_hyphen = "dH",
},
options = {
pitches_language = "default",
hyphenation_language = "en_DEFAULT",
output = "pdf",
backend = nil,
main_file = "main.ly",
main_folder = "%:p:h",
include_dir = nil,
pdf_viewer = nil,
errors = {
diagnostics = true,
quickfix = "external",
filtered_lines = {
"compilation successfully completed",
"search path"
}
},
},
},
latex = {
mappings = {
compile = "",
open_pdf = "",
lilypond_syntax = ""
},
options = {
lilypond_book_flags = nil,
clean_logs = false,
main_file = "main.tex",
main_folder = "%:p:h",
include_dir = nil,
lilypond_syntax_au = "BufEnter",
pdf_viewer = nil,
errors = {
diagnostics = true,
quickfix = "external",
filtered_lines = {
"Missing character",
"LaTeX manual or LaTeX Companion",
"for immediate help.",
"Overfull \\hbox",
"^%s%.%.%.",
"%s+%(.*%)"
}
},
},
},
texinfo = {
mappings = {
compile = "",
open_pdf = "",
lilypond_syntax = ""
},
options = {
lilypond_book_flags = "--pdf",
clean_logs = false,
main_file = "main.texi",
main_folder = "%:p:h",
lilypond_syntax_au = "BufEnter",
pdf_viewer = nil,
errors = {
diagnostics = true,
quickfix = "external",
filtered_lines = {
"Missing character",
"LaTeX manual or LaTeX Companion",
"for immediate help.",
"Overfull \\hbox",
"^%s%.%.%.",
"%s+%(.*%)"
}
},
},
},
player = {
mappings = {
quit = "q",
play_pause = "p",
loop = "",
backward = "h",
small_backward = "",
forward = "l",
small_forward = "",
decrease_speed = "j",
increase_speed = "k",
halve_speed = "",
double_speed = ""
},
options = {
row = 1,
col = "99%",
width = "37",
height = "1",
border_style = "single",
winhighlight = "Normal:Normal,FloatBorder:Normal,FloatTitle:Normal",
midi_synth = "fluidsynth",
fluidsynth_flags = nil,
timidity_flags = nil,
audio_format = "mp3",
mpv_flags = {
"--msg-level=cplayer=no,ffmpeg=no,alsa=no",
"--loop",
"--config-dir=/dev/null",
"--no-video"
}
},
},
}
}
```

Minimal config with Lazy and Blink (click to expand)

```lua
-- Install lazy.nvim

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end

vim.opt.rtp:prepend(lazypath)

-- Plugins config

require("lazy").setup({
{
"martineausimon/nvim-lilypond-suite",
opts = {}
},
{ 'nvim-lua/plenary.nvim', lazy = true }, -- Required for blink.cmp
{
'saghen/blink.cmp',
dependencies = {
'Kaiser-Yang/blink-cmp-dictionary', -- Required for dictionary completion
},
version = '*',
opts = {
sources = {
default = { 'dictionary', 'lsp', 'path', 'snippets', 'buffer' }, -- Add 'dictionary'
providers = {
dictionary = {
module = 'blink-cmp-dictionary',
name = 'Dict',
min_keyword_length = 3,
max_items = 8,
opts = {
dictionary_files = function()
if vim.bo.filetype == 'lilypond' then -- Add lilypond words to sources
return vim.fn.glob(vim.fn.expand('$LILYDICTPATH') .. '/*', true, true)
end
end,
}
},
},
},
},
opts_extend = { "sources.default" }
},
},{})

vim.diagnostic.config({ -- Show diagnostics if errors
virtual_text = true,
signs = true,
update_in_insert = false,
underline = true,
})

vim.api.nvim_create_autocmd('BufEnter', { -- Better highlights
command = "syntax sync fromstart",
pattern = { '*.ly', '*.ily', '*.tex', '*.texi', '*.texinfo' }
})

vim.api.nvim_create_autocmd( 'QuickFixCmdPost', { -- Show quickfix if errors, else close window
command = "cwindow",
pattern = "*"
})
```

## WIKI INDEX

* [Home](https://github.com/martineausimon/nvim-lilypond-suite/wiki)
* [Installation](https://github.com/martineausimon/nvim-lilypond-suite/wiki/1.-Installation)
* [nvim-lilypond-suite plugin](https://github.com/martineausimon/nvim-lilypond-suite/wiki/1.-Installation#nvim-lilypond-suite-plugin)
* [Dependences](https://github.com/martineausimon/nvim-lilypond-suite/wiki/1.-Installation#dependences)
* [midi/mp3 player](https://github.com/martineausimon/nvim-lilypond-suite/wiki/1.-Installation#midimp3-player)
* [Hyphenation function](https://github.com/martineausimon/nvim-lilypond-suite/wiki/1.-Installation#hyphenation-function)
* [Configuration](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration)
* [Customize default settings](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#customize-default-settings)
* [Per-folder configuration](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#per-folder-configuration)
* [Include directories](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#include-directories)
* [Highlightings](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#highlightings)
* [Recommended syntax sync settings](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#recommended-syntax-sync-settings)
* [Highlight groups](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#highlight-groups)
* [Highlight pitches for others languages](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#highlight-pitches-for-others-languages)
* [Lighter syntax highlighting](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#lighter-syntax-highlighting)
* [Error messages](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#error-messages)
* [Midi](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#midi)
* [Auto-completion](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#auto-completion)
* [Recommended settings](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#recommended-settings)
* [Dictionary files](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#dictionary-files)
* [Configuration example](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#configuration-example)
* [Point and click](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#point-and-click)
* [Neovim remote](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#neovim-remote)
* [Configure point and click](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#configure-the-point-and-click)
* [Pdf reader](https://github.com/martineausimon/nvim-lilypond-suite/wiki/2.-Configuration#pdf-reader)
* [Usage](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage)
* [Mappings & commands](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#mappings--commands)
* [LilyPond](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#lilypond)
* [LaTex](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#latex)
* [Player (LilyPond only)](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#player-mappings-lilypond-only)
* [Hyphenation function](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#hyphenation-function)
* [Default language](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#default-language)
* [Others languages](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#other-languages)
* [Output comparaison](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#outputs-comparaison)
* [Multiple files projects](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#multiple-files-projects)
* [LaTex](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#latex-1)
* [lilypond-book or lyluatex](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#lilypond-book-or-lyluatex)
* [Clean log files on exit](https://github.com/martineausimon/nvim-lilypond-suite/wiki/3.-Usage#clean-log-files-on-exit)
* [Tips and tricks](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks)
* [LaTex](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#latex)
* [Justify score with lilypond-book](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#justify-score-with-lilypond-book)
* [Adjust spaces between systems](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#adjust-spaces-between-systems)
* [Others](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#others)
* [Use `overseer.nvim` to compile automatically on save](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#use-overseernvim-to-compile-automatically-on-save)
* [Display error messages in a floating window](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#display-error-messages-in-a-floating-window)
* [Play any file on your system with the nvls player](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#play-any-file-on-your-system-with-the-nvls-player)
* [Use the QuickPlayer for every filetype](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#use-the-quickplayer-for-every-filetype)
* [Midi input in Neovim](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#midi-input-in-neovim)
* [Termux keyboard for lilypond](https://github.com/martineausimon/nvim-lilypond-suite/wiki/4.-Tips-and-tricks#termux-keyboard-for-lilypond)