For those who use vim, I'm posting this as result of my discovery of
python3-ly reformat thanks to David Wright in the hope that others may find
it useful.

This is for Debian or Ubuntu, and assumes the Python package python3-ly is
installed.

Add this code to ~/.vimrc:

" lilypond reformat (acb)
" reformat buffer, and return cursor to about the same place.
fun DoLilypondReformat()
    let l = line(".")
    let c = col(".")
    :%!ly reformat
    call cursor(l, c)
endfun

au Filetype lilypond nmap <F2> :call DoLilypondReformat()<CR>

Pressing F2 will reformat the current buffer. Note that, as with all code
tidying programs, you can only return the cursor to approximately the same
position, as lines may be added of deleted. But better than nothing.
Without that repositioning code, the cursor is repositioned at line 1 after
a filter operation in vim.

Andrew
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to