]> git.donarmstrong.com Git - lilypond.git/commitdiff
Vim: Use Lisp-style indentation where appropriate.
authorPatrick McCarty <pnorcks@gmail.com>
Mon, 26 Jul 2010 19:39:44 +0000 (12:39 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Mon, 26 Jul 2010 19:50:02 +0000 (12:50 -0700)
vim/lilypond-indent.vim

index 25d92e9baaaac42bae678df6ddd6d39692e2d1da..ea82090ec822a1798863fca2dc0d741fc9300951 100644 (file)
@@ -1,7 +1,7 @@
 " LilyPond indent file
 " Language:     LilyPond
 " Maintainer:   Heikki Junes <hjunes@cc.hut.fi>
-" Last Change:  2004 Mar 01
+" Last Change:  2010 Jul 26
 "
 " Installed As:        vim/indent/lilypond.vim
 "
@@ -38,6 +38,16 @@ function GetLilyPondIndent()
     let ind = ind - &sw
   endif
 
+  " Check if the previous line is a `lilyScheme' region, and if
+  " so, use lisp-style indentation for the current line.
+  " TODO: only works in version 7.1.215 or later, though it should
+  " silently fail in older versions.
+  for id in synstack(lnum, 1)
+    if synIDattr(id, "name") == "lilyScheme"
+      let ind = lispindent(v:lnum)
+    endif
+  endfor
+
   return ind
 endfunction
 "