On Wed, Nov 19, 2008 at 08:28:26AM -0800, coralline algae wrote: > I use vim in a terminal for editing, very occasionally something else > like abiword > I noticed recently and probably in the past that certain lilypond files were > not opening with the syntax coloring.
I'm using Vim 7.2 here. I tried pasting your code into a .ly file and opening it with Vim, both in a terminal and with gVim, and couldn't reproduce the behaviour you describe. I'm guessing that what you're doing is starting a file from scratch (i.e. without a filename)i; or, you're using some other extension than .ly. If you do this, Vim can't work out the filetype from the extension, so it has to guess. Without the comment lines at the top, Vim guesses (incorrectly) that your file is a generic config file, so it produces some (wrong) highlighting. With the comment lines, it doesn't guess anything. There are a few things you can do to let Vim know what you mean. Choose whichever one fits best with how you like to work. 1) When you start editing a new file, use :e something.ly to give Vim a filename to go on. It doesn't matter that something.ly doesn't already exist: Vim will assume you want to create it when you first do :w. This will automatically set the appropriate things up, just like when you open an existing file. (It works just as well to give the new filename as a command-line argument to Vim). 2) After you use :w something.ly to write a new file, use :e with no arguments immediately afterwards. This rereads the file you've just written, which triggers filetype detection. 3) If you are using some other extension, you can edit ~/.vim/ftdetect/lilypond.vim (such a file comes with Lilypond; if you installed through your package manager, it may be in /usr/share/vim/vim72 instead of ~/.vim). Copy the line that's already there and use a different extension like .itely. Lilypond dudes: please could we get some added to the installed version? Mine looks like au! BufNewFile,BufRead *.ly setf lilypond 4) You can use :set ft=lilypond to set the filetype for the file you're currently editing, in the current editing session. I think this is a bit of a last resort: it's much nicer to have Vim set the filetype automatically. On reflection, I guess that you're editing .lytex files or something, so option 3 is the one you want. -- "Sentiment breeds weakness. Let it get a hold of you and you are dead." -- Terry Nation, Blake's 7 C13 ‘Terminal’ http://surreal.istic.org/ One sells watches, the other watches cells.
signature.asc
Description: Digital signature
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user