]> git.donarmstrong.com Git - lilypond.git/commitdiff
* vim/lilypond-indent.vim: use <TAB> is indent character in
authorHeikki Junes <heikki.junes@hut.fi>
Thu, 11 Mar 2004 22:30:41 +0000 (22:30 +0000)
committerHeikki Junes <heikki.junes@hut.fi>
Thu, 11 Mar 2004 22:30:41 +0000 (22:30 +0000)
insert-mode. add indenting rules.

ChangeLog
vim/lilypond-indent.vim

index 522e8a2009c472031bd206eba220fd105830164c..1e9d507928618e525a0a004f4c90c0ba044d96da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-12  Heikki Junes <hjunes@cc.hut.fi>
+
+       * vim/lilypond-indent.vim: use <TAB> is indent character in
+       insert-mode. add indenting rules.
+
 2004-03-11  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * lily/parser.yy (toplevel_expression)[PAGE_LAYOUT]: Remove
index e2426d6d89c2e66633bfd32b94279c0ef79cd671..1f6c681e3bf1c6e28f8db2da10551a047ab65401 100644 (file)
@@ -10,6 +10,7 @@ endif
 let b:did_indent = 1
 
 setlocal indentexpr=GetLilyPondIndent()
+setlocal indentkeys+==},>>,!<TAB>
 
 " Only define the function once.
 if exists("*GetLilyPondIndent")
@@ -23,7 +24,17 @@ function GetLilyPondIndent()
 
   "Find a non-blank line above the current line.
   let lnum = prevnonblank(v:lnum - 1)
-  let ind = indent(lnum)
+  "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