" LilyPond indent file " Language: LilyPond " Maintainer: Heikki Junes " Last Change: 2004 Mar 01 " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetLilyPondIndent() setlocal indentkeys+==},>>,! " Only define the function once. if exists("*GetLilyPondIndent") finish endif function GetLilyPondIndent() if v:lnum == 1 return 0 endif "Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) "Check if a block was started: '{' or '<<' is the last non-blank character of the line. if getline(lnum) =~ '^.*\({\|<<\)\s*$' let ind = indent(lnum) + &sw else let ind = indent(lnum) endif "Check if a block was ended: '}' or '>>' is the first non-blank character of the line. if getline(v:lnum) =~ '^\s*\(}\|>>\)' let ind = ind - &sw endif return ind endfunction " " "