4.1.1 Configuring the system

When this functionality is active, LilyPond adds hyperlinks to PDF and SVG files. These hyperlinks are sent to a ‘URI helper’ or a web-browser, which opens a text-editor with the cursor in the right place.

To make this chain work, you should configure your PDF viewer to follow hyperlinks using the lilypond-invoke-editor script supplied with LilyPond.

The program lilypond-invoke-editor is a small helper program. It will invoke an editor for the special textedit URIs, and run a web browser for others. It looks up the environment variables EDITOR and LYEDITOR to find out and launch the favorite editor to use. LYEDITOR will have priority over EDITOR, so we recommend using the former especially if you want to use one editor in the terminal and another editor for LilyPond point and click.

Every editor may have a different syntax to open a file in a specific line and column. For user’s convenience, LilyPond comes with ready commands for several editors, listed in scripts/lilypond-invoke-editor.py. This means that you can simply write the editor binary name, e.g.:

export LYEDITOR=atom

and this will invoke

atom %(file)s:%(line)s:%(column)s

where %(file)s, %(line)s and %(column)s are replaced with the file, line and column respectively.

In order to use an editor not listed in the script, you should find its specific syntax and assign the full command to LYEDITOR. Here’s an example for Visual Studio Code editor:

export LYEDITOR="code --goto %(file)s:%(line)s:%(column)s"

Note: If you choose Emacs, an extra configuration is needed. You should add the line (server-start) to your ~/.emacs file, otherwise every click on an object in the PDF will open a new Emacs window.

LilyPond Application Usage v2.25.17 (development-branch).