3 " Maintainer: Heikki Junes <hjunes@cc.hut.fi>
4 " Last Change: 2004 Mar 01
6 " Installed As: vim/indent/lilypond.vim
8 " Only load this indent file when no other was loaded.
9 if exists("b:did_indent")
14 setlocal indentexpr=GetLilyPondIndent()
15 setlocal indentkeys=o,O,},>>,!^F
17 " Only define the function once.
18 if exists("*GetLilyPondIndent")
22 function GetLilyPondIndent()
27 "Find a non-blank line above the current line.
28 let lnum = prevnonblank(v:lnum - 1)
29 "Check if a block was started: '{' or '<<' is the last non-blank character of the previous line.
30 if getline(lnum) =~ '^.*\({\|<<\)\s*$'
31 let ind = indent(lnum) + &sw
33 let ind = indent(lnum)
36 "Check if a block was ended: '}' or '>>' is the first non-blank character of the current line.
37 if getline(v:lnum) =~ '^\s*\(}\|>>\)'