For those that might be interested, here is what I did to make this work for
me in VIM, using a little of shell scripting:-
Requirements for this script to work are:
hxpipe which is part of html-xml-utils package. Please find a version
for your particular distribution.
awk which should be present on your machine, if it's not install that
too.
- And of course, our main buddy
lilypond-book.
#!/bin/bash
fromvim="$1"
PID=$$
lilypond-book -f html -o output "$fromvim" 2>/dev/null
hxpipe output/stdin.html | awk '/src/||/href/ {$3="output/"$3;}{ print }' | hxunpipe > result$PID
cat result$PID
exit 0
Save this as ly2vim, make it executable with chmod +x ly2vim and place it into some directory, in your path.
Now the VIM part:
Add the following to your .vimrc configuration file:-
#note the dash symbol, it is important, as it will send current line from `VIM` as standard input to `lilypond-book` command.
nnoremap <leader>ly :.!ly2vim -<CR>
That's it. Now when you are in a middle of editing your html file, you just
place line like this:-
<lilypondfile>yourmusic.ly</lilypondfile>
While cursor anywhere on that line, do your <leader>ly key combination while
in normal mode, and voila!, png file will be generated, and code snippet
inserted at that place for you. Preview in your browser, and enjoy! :)
.lyfile that contains the entire score and (2) some way to export snippets from it to HTML without having to manually/explicitly copy content from the score file into a separate file? – Dave Sep 19 '14 at 19:29viper-modefor emacs. – Dave Sep 19 '14 at 19:45