Skip to content

3. Usage

Simon Martineau edited this page Aug 1, 2023 · 6 revisions

MAPPINGS & COMMANDS

Lilypond

Mode Default key Description
n <F3> :LilyPlayer command : Convert midi file to mp3 and play in a floating window
v <F3> QuickPlayer : play visual selection only (experimental)
n <F4> Insert current version
n <F5> :LilyCmp command : Save & compile pdf (or other format output)
n <F6> :Viewer command Open %.pdf (or other format output)
n <F11> :HyphChLang command : quickly change language
v <F12> Automatically add hyphens
n <leader>ih Insert an hyphen (before cursor)
n <leader>ah Add an hyphen (after cursor)
n <leader>dh Delete next hyphen
n <leader>dH Delete previous hyphen

LaTex

Mode Default mappings Description
n <F3> :ToggleSyn command : Enable or disable LilyPond embed syntax
n <F5> :TexCmp command : Save & compile pdf
n <F6> :Viewer command : Open %.pdf

Player mappings (LilyPond only)

Key Description
<A-Space> Switch between player and LilyPond buffers
q and <Esc> Exit player
p Play / Pause
<A-l> Loop start/stop/clean
h and l Seek backward/forward 5 sec
<S-h> and <S-l> Seek backward/forward 1 sec
<S-j> and <S-k> Halve/double current playback speed
j and k Decrease/increase current playback speed by 10%

HYPHENATION FUNCTION

This function automatically place hyphens ' -- ' inside texts to make those texts usable as lyrics. All mappings for this function are listed on the LilyPond mappings section

Default language

I strongly recommend the en_DEFAULT language. It is based on a dictionary created for use with Philip Aker’s Text Editor plugin, used within Finale (Mac version) which suits very well for lyrics.
You can find more informations about this dictionary on this website : http://hindson.com.au/info/free/free-english-language-hyphenation-dictionary/

This dictionary is included in nvim-lilypond-suite, and does not require any dependencies.

Other languages

If you want to use a different language, this is possible with this plugin using the :HyphChLang function (default mapping <F11>). It will load a python module called Pyphen, which is also used by OpenOffice and other text softwares (see the Dependences wiki page for this module).

⚠ Currently this module does not work with line breaks.

That word processor hyphenation dictionaries often don't want to break a word right after the first letter, because that does not look nice in word processor texts. So it might be possible that you have to add some hyphens after the first letter of such lyrics.

Available languages :

af_ZA, be_BY, bg_BG, ca, cs_CZ, da_DK, de_AT, de_CH, de_DE, el_GR, en_GB, en_US, eo, es, et_EE, fr, gl, hr_HR, hu_HU, id_ID, is, it_IT, lt, lv_LV, mn_MN, nb_NO, nl_NL, nn_NO, pl_PL, pt_BR, pt_PT, ro_RO, ru_RU, sk_SK, sl_SI, sq_AL, sr, sr_Latn, sv, te_IN, uk_UA, zu_ZA

Outputs comparaison

Here is a sample of text :

available associated creation organisation

  • en_DEFAULT output :

a -- vail -- a -- ble as -- so -- ci -- a -- ted cre -- a -- tion or -- ga -- ni -- sa -- tion

  • en_GB output :

avail -- able as -- so -- ci -- ated cre -- ation or -- gan -- isa -- tion

  • Frescobaldi output :

avail -- able as -- so -- ci -- at -- ed cre -- ation or -- gan -- i -- sa -- tion


MULTIPLE FILES PROJECTS

When working on a multiple files project, with \included sources in a main file, only the file called main.ly in current folder is selected for compilation, open pdf and play midi. You can change this default by editing main_file and main_folder options in require('nvls').setup()

To use a different configuration per folder, you will need nvim exrc :

  • make sure you have the following option in your init.lua:
vim.opt.exrc = true
  • create the .nvim.lua file in your directory, containing the new config e.g.:
require('nvls').setup({
  lilypond = {
    options = {
      main_file = "my_main_file.ly",
    },
  },
})

LATEX

lilypond-book or lyluatex

This plugin works with lilypond-book by default if the .tex file contains \begin{lilypond}. To use lyluatex, just add \usepackage{lyluatex} to your preamble.

NOTE : lyluatex package does not allow files containing spaces, and does not allow compiling in a directory other than the working directory

Syntax highlighting can be slow with embedded LilyPond, you can use <F3> to activate or deactivate it.

You can also chose on which event LilyPond syntax is reloaded, e.g. :

require('nvls').setup({
  latex = {
    options = {
      lilypond_syntax_au = { "BufWrite", "VimEnter" }
    },
  },
})

Clean log files on exit

Define true to clean_logs option in require('nvls').setup()