Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

A Vim and NeoVim filetype plugin for LilyPond & TeX files.

License

Notifications You must be signed in to change notification settings

martineausimon/vim-lilypond-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INFO

⚠ This plugin is not maintened anymore, if you use NeoVim, I recommend you to use nvim-lilypond-suite instead.

vim-lilypond-suite

This is a filetype plugin for LilyPond, with updated syntax and dictionary for auto-completion. This repository also contains an ftplugin for TeX files which allows embedded LilyPond syntax highlighting, and makeprg which support lilypond-book or lyluatex package out of the box.

  • Features
  • Installation
  • Mappings
  • Settings
    • Lighter syntax highlighting
    • QuickFix mode
    • Recommended highlightings
    • Recommended settings for Auto-completion
    • Point & click configuration
  • LaTex
    • Clean log files on exit
    • Overfull messages in QuickFix
    • Tricks for lilypond-book
  • License

Features

  • Updated syntax file using the last Pygments syntax highlighter for LilyPond
  • Simple ftplugin for LilyPond with makeprg, correct errorformat
  • ftplugin fo TeX files whith detect and allows embedded LilyPond syntax, adaptive makeprg function for lyluatex or lilypond-book, correct errorformat

Installation

If you use vim-plug, then add the following line to your .vimrc file:

Plug 'martineausimon/vim-lilypond-suite'

Or use some other plugin manager:

Mappings

  • F3 : toggle LilyPond syntax (LaTeX only)
  • F4 : insert current version (LilyPond only)
  • F5 : save & make
  • F6 : view pdf (xdg-open)

Settings

Lighter syntax highlighting

Since the last big update c5ee51b, I changed my method for syntax highlighting and avoided word lists as much as possible, for more lightness.

Pitches language

For now only default, français, english and nohl (no highlight) are available for pitches highlighting. You can change language adding this line to your config :

let g:lilypond_language="français"

TODO : create pitches pattern for other languages

QuickFix mode

By default this plugin uses :cw after compile. To display only a result message in vim's message line after make, add this line to your .vimrc :

let g:vls_qf_mode='1'

Recommended highlightings

highlight Keyword 
	\ cterm=bold ctermfg=yellow 
	\ gui=bold guifg=yellow
highlight Tag 
	\ ctermfg=blue 
	\ guifg=blue
highlight Label 
	\ ctermfg=lightyellow 
	\ guifg=lightyellow
highlight SpecialComment 
	\ ctermfg=lightcyan 
	\ guifg=lightcyan
highlight SpecialChar
	\ cterm=bold ctermfg=lightmagenta
	\ gui=bold guifg=lightcyan
highlight PreCondit 
	\ ctermfg=cyan 
	\ guifg=cyan

Recommended settings for Auto-completion

install coc.nvim and coc-dictionary & coc-tabnine : works out of the box !

My settings for coc.nvim

function! s:check_back_space() abort
	let col = col('.') - 1
	return !col || getline('.')[col - 1]  =~ '\s'
endfunction

inoremap <silent><expr> <TAB>
	\ coc#pum#visible() ? coc#pum#next(1):
	\ <SID>check_back_space() ? "\<Tab>" :
	\ coc#refresh()

inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
inoremap <silent><expr> <cr> coc#pum#visible() && coc#pum#info()['index'] != -1 ? coc#pum#confirm() : "\<C-g>u\<CR>"

If you want to use another completion plugin like hrsh7th/nvim-cmp with uga-rosa/cmp-dictionary, vim-lilypond-suite uses the following dictionary files :

$LILYDICTPATH/grobs
$LILYDICTPATH/keywords
$LILYDICTPATH/musicFunctions
$LILYDICTPATH/articulations
$LILYDICTPATH/grobProperties
$LILYDICTPATH/paperVariables
$LILYDICTPATH/headerVariables
$LILYDICTPATH/contextProperties
$LILYDICTPATH/clefs
$LILYDICTPATH/repeatTypes
$LILYDICTPATH/languageNames
$LILYDICTPATH/accidentalsStyles
$LILYDICTPATH/scales
$LILYDICTPATH/musicCommands
$LILYDICTPATH/markupCommands
$LILYDICTPATH/contextsCmd
$LILYDICTPATH/dynamics
$LILYDICTPATH/contexts
$LILYDICTPATH/translators

My Neovim settings for Point & Click

Recommended pdf viewer : zathura with zathura-pdf-mupdf plugin

Add this line to ~/.config/zathura/zathurarc :

set synctex-editor-command "lilypond-invoke-editor %s"

Install neovim-remote and add this line to ~/.profile :

export LYEDITOR="nvr +:'call cursor(%(line)s,%(char)s)' %(file)s"

Follow the instructions on the LilyPond website to configure the system and create lilypond-invoke-editor.desktop

Reboot or reload with . ~/.profile

LaTex

This plugin works with lilypond-book by default if the .tex file contains \begin{lilypond}. To use lyluatex, just add \usepackage{lyluatex} to your preamble.

Syntax highlighting can be slow with embedded LilyPond, you can use <F3> to activate or deactivate it.

Clean log files on exit

Add this line to your .vimrc to remove log files on exit :

let g:vls_clean_tex_files='1'

Display Overfull messages in QuickFix

Add this line to your .vimrc :

let g:vls_tex_qf_overfull='1'

Tricks for lilypond-book

Add this lines to your preamble to avoid the padding on the left side and keep the score justified :

\def\preLilyPondExample{\hspace*{-3mm}}
\newcommand{\betweenLilyPondSystem}[1]{\linebreak\hspace*{-3mm}}

Adjust space between systems using this line (in \renewcommand or \newcommand) :

{\betweenLilyPondSystem}[1]{\vspace{5mm}\linebreak\hspace*{-3mm}}

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Releases

No releases published

Packages

No packages published