summaryrefslogtreecommitdiffstats
path: root/indent
diff options
context:
space:
mode:
Diffstat (limited to 'indent')
-rw-r--r--indent/edc.vim83
-rw-r--r--indent/indent_pir.vim75
-rw-r--r--indent/scala.vim85
3 files changed, 0 insertions, 243 deletions
diff --git a/indent/edc.vim b/indent/edc.vim
deleted file mode 100644
index 498be4a..0000000
--- a/indent/edc.vim
+++ /dev/null
@@ -1,83 +0,0 @@
-" Vim indent file
-" Language: EDC
-" Maintainer: Viktor Kojouharov
-" Latest Revision: 2007 02 24
-
-if exists("b:did_indent")
- finish
-endif
-let b:did_indent = 1
-
-setlocal indentexpr=GetEDCIndent()
-setlocal indentkeys=0{,0},!^F,o,O
-
-if exists("*GetEDCIndent")
- finish
-endif
-
-function s:prevnonblanknoncomment(lnum)
- let lnum = a:lnum
- while lnum > 1
- let lnum = prevnonblank(lnum)
- let line = getline(lnum)
- if line =~ '\*/'
- while lnum > 1 && line !~ '/\*'
- let lnum -= 1
- endwhile
- if line =~ '^\s*/\*'
- let lnum -= 1
- else
- break
- endif
- elseif line =~ '^\s*//'
- let lnum -= 1
- else
- break
- endif
- endwhile
- return lnum
-endfunction
-
-function s:count_braces(lnum, count_open)
- let n_open = 0
- let n_close = 0
- let line = getline(a:lnum)
- let pattern = '[{}]'
- let i = match(line, pattern)
- while i != -1
- if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'c\%(CommentL\|Comment\|StringQ\{1,2}\)'
- if line[i] == '{'
- let n_open += 1
- elseif line[i] == '}'
- if n_open > 0
- let n_open -= 1
- else
- let n_close += 1
- endif
- endif
- endif
- let i = match(line, pattern, i + 1)
- endwhile
- return a:count_open ? n_open : n_close
-endfunction
-
-function GetEDCIndent()
- let line = getline(v:lnum)
- if line =~ '^\s*\*' || line =~ '^\s*//' || line =~ '^\s*}'
- return cindent(v:lnum)
- endif
-
- let pnum = s:prevnonblanknoncomment(v:lnum - 1)
- if pnum == 0
- return 0
- endif
-
- let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw
-
- let pline = getline(pnum)
- if pline =~ '}\s*$'
- let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw
- endif
-
- return ind
-endfunction
diff --git a/indent/indent_pir.vim b/indent/indent_pir.vim
deleted file mode 100644
index 29dd9f6..0000000
--- a/indent/indent_pir.vim
+++ /dev/null
@@ -1,75 +0,0 @@
-" Description: imcc indenter
-" Author: Andrew Rodland <arodland@entermail.net>
-" Last Change: 2004 Aug 3
-
-" As usual, we want to be alone
-if exists("b:did_indent")
- finish
-endif
-let b:did_indent=1
-
-setlocal indentexpr=PIRIndent()
-setlocal indentkeys=o,O,*<Return>,<bs>,:,=.end,0#
-
-fun! InPOD(lnum)
- return synIDattr(synID(a:lnum, 1, 1), "name") =~? '^myPod$\|^pod[A-Z]'
-endfun
-
-fun! PIRIndent()
- let thisline = getline(v:lnum)
-
- let POD_START = '^=[a-z]'
-
- if thisline =~? POD_START
- return 0
- endif
-
-
- if InPOD(v:lnum)
- return -1
- endif
-
- let LABEL_OR_COMMENT = '^\s*\k\+:\s*$\|^#'
- if thisline =~? LABEL_OR_COMMENT
- return 0
- endif
-
- let lnum=v:lnum
- while lnum > 0
- let lnum = prevnonblank(lnum-1)
- let prevline = getline(lnum)
-
- if prevline !~? LABEL_OR_COMMENT
- if !InPOD(lnum)
- break
- endif
- endif
- endwhile
-
- if lnum < 1
- return 0
- endif
-
- let ind = indent(lnum)
-
- let SUB = '^\s*\.pcc_sub\s\+\|^\s*\.sub\s\+'
- let RETURNBLOCK = '\s*\.pcc_begin_return\s*$'
- let END = '^\s*\.end\s*$\|^\s*\.pcc_end_return\s*$'
-
- if prevline =~? SUB
- let ind = ind + &sw
- endif
-
- if prevline =~? RETURNBLOCK
- let ind = ind + &sw
- endif
-
- if thisline =~? END
- let ind = ind - &sw
- endif
-
- return ind
-
-endfun
-
-
diff --git a/indent/scala.vim b/indent/scala.vim
deleted file mode 100644
index c3e7c91..0000000
--- a/indent/scala.vim
+++ /dev/null
@@ -1,85 +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,<>>,<CR>
-
-setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab
-
-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\)\>.*[)]\s*$'
- \ || prevline =~ '^\s*\<\(\(va[lr]\|def\)\>.*[=]\s*$'
- \ || prevline =~ '^\s*\<else\>\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\)\>.*[)]\s*$'
- \ || pprevline =~ '^\s*\<\(\va[lr]\|def\)\>.*[=]\s*$'
- \ || pprevline =~ '^\s*\<else\>\s*$'
- let ind = ind - &shiftwidth
- endif
-
- " Align 'for' clauses nicely
- if prevline =~ '^\s*\<for\> (.*;\s*$'
- let ind = ind - &shiftwidth + 5
- endif
-
- " Subtract a 'shiftwidth' on '}' or html
- let thisline = getline(v:lnum)
- if thisline =~ '^\s*[})]'
- \ || thisline =~ '^\s*</[a-zA-Z][^>]*>'
- let ind = ind - &shiftwidth
- endif
-
- return ind
-endfunction