Chapter 3. Basic features

Table of Contents

jEdit is a very versatile text editor. While working on LilyPond scores you often need jEdit's features instead of the plugin's features, e.g. setting shortcuts, abbreviation, printing etc. Use jEdit's help system to learn about the features.

There are many other plugins you may find useful, like Navigator and XInsert.

Text editing features

Syntax coloring

The first feature you get when you load a LilyPond file (with .ly extension) into jEdit is syntax coloring. Commands, user commands, assignments etc. colored automatically for you.

Code folding

When the plugin is active and a .ly file is edited, jEdit provides folding handles to fold parts of the text. Click on the small triangles on the left to fold and unfold blocks of the text.

Other text features

There are standard features as well, which are provided by jEdit. For example pressing Ctrl-i will indent the selected text, Ctrl-e Ctrl-k (there are double shortcuts in jEdit) will make line comments. Ctrl-b will help you complete the word based on previous word. There are many other useful features, just look in jEdit manual.

LilyPond shell

LilyPond plugin uses a special shell in the Console plugin for running LilyPond-related programs. You can dock Console or use it as a floating window. You can set this behaviour in Utilities>Global Options... selecting jEdit>Docking. If you open the Console window (Plugins>Console>Console) and choose LilyPond from its combo box (instead of System), you get a console window like this (you can change colors and fonts of Console in Plugins>Plugin Options):

Figure 3.1. The Console window with the LilyPond shell

The Console window with the LilyPond shell

Using the LilyPond shell (selectable in the Console window) Windows users can even run these programs in Cygwin, without explicitly invoking bash.

Important

To use the LilyPond shell in Windows, you must set the path to bash.exe in Plugins>Plugin options. (The most common setting is C:\cygwin\bin\bash.exe)

Running LilyPond

You can run LilyPond to process the current file either by selecting it from the Plugins>LilyTool menu or by clicking on the LilyPond tool bar. It may be a good idea to define a shortcut for this action to run it with a simple keystroke.

Running convert-ly

It is very common to convert older documents to the current version of LilyPond. You can do this by running the command convert-ly, which can also be invoked from the toolbar or from the menu, as a LilyTool action. If you invoke it, the current buffer will be processed and reloaded. (You must have the appropriate \version setting in your file or convert-ly won't know from what version you ar converting.)

Running custom commands in the Console

For example, you would like to process your file using lilypond --verbose. You can use the keyword %buffer as a parameter in the console, to substitute the current buffer's path. Example:

lilypond --verbose %buffer

Make sure that the LilyPond shell is selected when executing the command.

Navigation and error checking

LilyTool provides a quick parsing of the score without running LilyPond. This feature is used by the Structure Browser (provided by the SideKick plugin), but will also let you find simple errors faster, and helps in the automatic code completion.

Parsing is done when you save the document.

You may find the Navigator plugin useful, because it lets you navigate back and forth through the places where you edited the score.

Structure browser

If you dock the Structure Browser, you can use it to easily jump to the parts of the score. The document is parsed when you save it.

Finding simple errors

If you save the document, the parser looks for simple errors:

  • Unmatched braces

  • Unmatched brackets and parentheses

This is often very useful, because you can find these errors without running LilyPond. You only have to save the document.

Errors that are found when saving the documents and errors that are found during processing the score with LilyPond are put in the error list provided by the ErrorList plugin. You can set the ErrorList plugin to appear when there are errors. Perhaps you would like to dock it.

You can see the erroneous places underlined, and you can easily get to them with a click in the Error List.

Bar checks

When you press the | key (that puts a bar check in the score, so LilyPond will report if there would be no barline there), the length of the last measure is counted and displayed in the status bar. For example, with the input

c8 d e4 f |

a small tooltip will show "3/4", and the status bar will show: 'Beat: 3/4'

Viewing and playing

You can view the processed document and play the midi file without leaving jEdit.

DVI and point-and-click

The best method to view your processed score during editing is using the integrated jDvi viewer. It also provides point-and-click editing, i.e. you can click on a note (or lyrics syllable) to immediately jump to the appropriate place in the source document.

Note

Point-and-click doesn't work with chords.

Setting up for point-and-click

To make the point-and-click feature work you must include the following line into your document:

#(ly:set-point-and-click 'line-column)

Choose LilyPond>Source editing>Enable point-and-click to let LilyTool insert this line into your document. You can read about all features in the LilyPond menu in the next chapter.

First run can be slow!

Before viewing the dvi file jDvi may have to make the fonts first. So please patient. Some glyphs or lines may not show up. In that case try running

updmap --enable Map ec-mftrace.map

in the LilyPond shell (see above).

PS viewer

There is a very simple 'integrated' PS viewer in LilyTool. It uses gs to render the PS file into PNG images and show them in a window.

MIDI player

You can listen to the generated midi file (if there is one) using the Midi player feature.

Automatic completions and instant help

The LilyPond plugin provides automatic completion for typing commands, context names, other keywords, and even when overriding or setting object and context properties. It also provides instant help for context, properties and markup commands, so you don't have to browse the documentation for them.

You can get instant help on the commands, properties etc. if you leave your mouse for some time on the word.

Figure 3.2. Instant help on the extra-X-extent property

Instant help on the extra-X-extent property

This completion feature is based on LilyJHelp, which contains the documentation of LilyPond.

To get the most out of this feature you should set a shortcut for Plugins>SideKick>Show completion popup. The best choice for a shortcut may be Ctrl-Space.

You can select a word by typing a non-alphanumeric character or by clicking on it.

Command completion

When you press the \ key, the completion popup automatically appears and you can choose the selected keyword by typing a non-word letter. If you continue typing with the completion window open, it automatically filters the words you can select from.

You can get a description of some commands (currently all markup commands) in a tooltip box if you leave the mouse for some time on it.

Code assist

While writing your scores in LilyPond you often need to tweak some default values. For example if you would like to set the minimumVerticalExtent property of a Staff context you can use the following code:

\set Staff.minimumVerticalExtent = #'(-3 . 4)

Using the automatic completion feature setting properties like this is much easier. After typing the \set keyword, the completion popup is shown (you can turn of the completion list by the shortcut you set for Plugins>SideKick>Show completion popup). Now you can see the contexts you can choose from. Assume you chose Staff (e.g. by typing St and pressing space), so you have \set Staff now. Press ., and now you can choose a property. If you chose the property, the completion automatically ends the assignment, filling out the value with the default value or a template value (if the default value is not set).

Figure 3.3. Code assist filled in the default value

Code assist filled in the default value

Overriding object properties works just like setting context properties. Type \override, activate the popup, choose a context, press ., choose a layout object, and finally choose a property.

You can get instant help of a context or a property, if you stay on it with your mouse before selecting it.

LilyPond help

If you've installed the LilyJHelp package, you can display LilyPond documentation in JavaHelp format. This format is easier to search and browse than the original web based documentation. However, its disadvantage is that it must be built separately from the documentation, so it may be not totally up to date.