Mercurial > hg > RemoteEditor > vim7
diff runtime/indent/java.vim @ 48:67300faee616 v7-3-618
v7-3-618
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 01 Aug 2012 18:08:28 +0900 |
parents | 76efa0be13f1 |
children |
line wrap: on
line diff
--- a/runtime/indent/java.vim Wed Aug 01 18:03:06 2012 +0900 +++ b/runtime/indent/java.vim Wed Aug 01 18:08:28 2012 +0900 @@ -1,7 +1,12 @@ " Vim indent file " Language: Java -" Maintainer: Toby Allsopp <toby.allsopp@peace.com> (resigned) -" Last Change: 2005 Mar 28 +" Previous Maintainer: Toby Allsopp <toby.allsopp@peace.com> +" Current Maintainer: Hong Xu <xuhdev@gmail.com> +" Last Change: 2012 May 18 +" Version: 1.0 +" License: Same as Vim. +" Copyright (c) 2012 Hong Xu +" Before 2012, this file is maintained by Toby Allsopp. " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -24,6 +29,8 @@ if exists("*GetJavaIndent") finish endif +let s:keepcpo= &cpo +set cpo&vim function! SkipJavaBlanksAndComments(startline) let lnum = a:startline @@ -60,6 +67,13 @@ " find start of previous line, in case it was a continuation line let lnum = SkipJavaBlanksAndComments(v:lnum - 1) + + " If the previous line starts with '@', we should have the same indent as + " the previous one + if getline(lnum) =~ '^\s*@\S\+\s*$' + return indent(lnum) + endif + let prev = lnum while prev > 1 let next_prev = SkipJavaBlanksAndComments(prev - 1) @@ -127,4 +141,7 @@ return theIndent endfunction +let &cpo = s:keepcpo +unlet s:keepcpo + " vi: sw=2 et