From 4c8346948c404ec9c6d69cf352f0e9d89e50b2e8 Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Mon, 19 Dec 2011 02:23:46 -0500 Subject: get rid of all the old cruft --- vim/indent/scala.vim | 83 ---------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 vim/indent/scala.vim (limited to 'vim/indent/scala.vim') diff --git a/vim/indent/scala.vim b/vim/indent/scala.vim deleted file mode 100644 index 45266a0..0000000 --- a/vim/indent/scala.vim +++ /dev/null @@ -1,83 +0,0 @@ -" Vim indent file -" Language : Scala (http://scala-lang.org/) -" Maintainer : Stefan Matthias Aust -" Last Change: 2006 Apr 13 - -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -setlocal indentexpr=GetScalaIndent() - -setlocal indentkeys=0{,0},0),!^F,<>>, - -setlocal autoindent sw=2 et - -if exists("*GetScalaIndent") - finish -endif - -function! CountParens(line) - let line = substitute(a:line, '"\(.\|\\"\)*"', '', 'g') - let open = substitute(line, '[^(]', '', 'g') - let close = substitute(line, '[^)]', '', 'g') - return strlen(open) - strlen(close) -endfunction - -function! GetScalaIndent() - " Find a non-blank line above the current line. - let lnum = prevnonblank(v:lnum - 1) - - " Hit the start of the file, use zero indent. - if lnum == 0 - return 0 - endif - - let ind = indent(lnum) - let prevline = getline(lnum) - - "Indent html literals - if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$' - return ind + &shiftwidth - endif - - " Add a 'shiftwidth' after lines that start a block - " If if, for or while end with ), this is a one-line block - " If val, var, def end with =, this is a one-line block - if prevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\|va[lr]\|def\)\>.*[)=]\s*$' - \ || prevline =~ '^\s*\\s*$' - \ || prevline =~ '{\s*$' - let ind = ind + &shiftwidth - endif - - " If parenthesis are unbalanced, indent or dedent - let c = CountParens(prevline) - echo c - if c > 0 - let ind = ind + &shiftwidth - elseif c < 0 - let ind = ind - &shiftwidth - endif - - " Dedent after if, for, while and val, var, def without block - let pprevline = getline(prevnonblank(lnum - 1)) - if pprevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\|va[lr]\|def\)\>.*[)=]\s*$' - \ || pprevline =~ '^\s*\\s*$' - let ind = ind - &shiftwidth - endif - - " Align 'for' clauses nicely - if prevline =~ '^\s*\ (.*;\s*$' - let ind = ind - &shiftwidth + 5 - endif - - " Subtract a 'shiftwidth' on '}' or html - let thisline = getline(v:lnum) - if thisline =~ '^\s*[})]' - \ || thisline =~ '^\s*]*>' - let ind = ind - &shiftwidth - endif - - return ind -endfunction -- cgit v1.2.3