From 845257fa959b66d0579fb78a26bfcaecb43d645c Mon Sep 17 00:00:00 2001 From: Heikki Junes Date: Thu, 11 Mar 2004 22:30:41 +0000 Subject: [PATCH] * vim/lilypond-indent.vim: use is indent character in insert-mode. add indenting rules. --- ChangeLog | 5 +++++ vim/lilypond-indent.vim | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 522e8a2009..1e9d507928 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-03-12 Heikki Junes + + * vim/lilypond-indent.vim: use is indent character in + insert-mode. add indenting rules. + 2004-03-11 Jan Nieuwenhuizen * lily/parser.yy (toplevel_expression)[PAGE_LAYOUT]: Remove diff --git a/vim/lilypond-indent.vim b/vim/lilypond-indent.vim index e2426d6d89..1f6c681e3b 100644 --- a/vim/lilypond-indent.vim +++ b/vim/lilypond-indent.vim @@ -10,6 +10,7 @@ endif let b:did_indent = 1 setlocal indentexpr=GetLilyPondIndent() +setlocal indentkeys+==},>>,! " 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 -- 2.39.2