Obies using Lilypond

Our adventures with the best engraving software. Not affiliated with Oberlin College and Conservatory.


My workflow

William Rehwinkel: How I write lilypond code using vim

Over the last five years I have been engraving music in Lilypond using vim. Since I also use vim for programming, I find the way that I can navigate around files to be very comfortable. By using the vim text editor, saving incremental changes with git, and using the following bash script, I have found it incredibly easy to work on lilypond projects, even those that are very complex.

This article is a quick introduction to the tools that I use to work on Lilypond.

vim

I added the following lines in the .vimrc file to add the included lilypond syntax highlighting to vim.

" lilypond
filetype off
set runtimepath+=/<path to>/lilypond-2.25.21/share/lilypond/2.25.21/vim
filetype on
syntax on

bash script

At the very beginning of my time using lilypond, I would type :w and then !lilypond % && open <filename>.pdf to quickly open the pdf file and check my progress. Later on, my dad shared a bash script that he uses to quickly re-compile a file after saving it, and I modified it to work with lilypond file.

Here is the script that I use now, using fswatch to check for when I save the file. I copy it into the directory of every new project.

#!/bin/sh

s="$1"
while true
do
    clear
    date
    lilypond $s.ly
    open $s.pdf
    sleep 5
    fswatch -1 $s.ly
done

# $ ./testloop file

Note: On MacOS this script opens the PDF file using Preview. Depending on what I am working on, I may have the manuscript that I am transcribing open with Preview as well. In this case, closing that window with cmd-Q is an annoyance. To prevent this, I like to open other images that I am using with another program such as Safari.