updated for version 7.0g
This commit is contained in:
@ -319,4 +319,4 @@ endfunction
|
||||
"
|
||||
" BUGS: You tell me! Probably. I just haven't found one yet or haven't been
|
||||
" told about one.
|
||||
"
|
||||
"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: Ada
|
||||
" Maintainer: Neil Bird <neil@fnxweb.com>
|
||||
" Last Change: 2004 Nov 23
|
||||
" Last Change: 2006 Apr 30
|
||||
" Version: $Id$
|
||||
" Look for the latest version at http://vim.sourceforge.net/
|
||||
"
|
||||
@ -44,25 +44,25 @@ function s:MainBlockIndent( prev_indent, prev_lnum, blockstart, stop_at )
|
||||
let line = substitute( getline(lnum), s:AdaComment, '', '' )
|
||||
while lnum > 1
|
||||
if a:stop_at != '' && line =~ '^\s*' . a:stop_at && indent(lnum) < a:prev_indent
|
||||
return a:prev_indent
|
||||
return a:prev_indent
|
||||
elseif line =~ '^\s*' . a:blockstart
|
||||
let ind = indent(lnum)
|
||||
if ind < a:prev_indent
|
||||
return ind
|
||||
endif
|
||||
let ind = indent(lnum)
|
||||
if ind < a:prev_indent
|
||||
return ind
|
||||
endif
|
||||
endif
|
||||
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
" Get previous non-blank/non-comment-only line
|
||||
while 1
|
||||
let line = substitute( getline(lnum), s:AdaComment, '', '' )
|
||||
if line !~ '^\s*$' && line !~ '^\s*#'
|
||||
break
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
if lnum <= 0
|
||||
return a:prev_indent
|
||||
endif
|
||||
let line = substitute( getline(lnum), s:AdaComment, '', '' )
|
||||
if line !~ '^\s*$' && line !~ '^\s*#'
|
||||
break
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
if lnum <= 0
|
||||
return a:prev_indent
|
||||
endif
|
||||
endwhile
|
||||
endwhile
|
||||
" Fallback - just move back one
|
||||
@ -82,15 +82,15 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend )
|
||||
while lnum > 1
|
||||
if getline(lnum) =~ '^\s*' . a:blockstart
|
||||
let ind = indent(lnum)
|
||||
if ends <= 0
|
||||
if ind < a:prev_indent
|
||||
if ends <= 0
|
||||
if ind < a:prev_indent
|
||||
return ind
|
||||
endif
|
||||
else
|
||||
let ends = ends - 1
|
||||
endif
|
||||
else
|
||||
let ends = ends - 1
|
||||
endif
|
||||
elseif getline(lnum) =~ '^\s*' . a:blockend
|
||||
let ends = ends + 1
|
||||
let ends = ends + 1
|
||||
endif
|
||||
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
@ -122,25 +122,25 @@ function s:StatementIndent( current_indent, prev_lnum )
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
" Get previous non-blank/non-comment-only line
|
||||
while 1
|
||||
let line = substitute( getline(lnum), s:AdaComment, '', '' )
|
||||
if line !~ '^\s*$' && line !~ '^\s*#'
|
||||
break
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
if lnum <= 0
|
||||
return a:current_indent
|
||||
endif
|
||||
let line = substitute( getline(lnum), s:AdaComment, '', '' )
|
||||
if line !~ '^\s*$' && line !~ '^\s*#'
|
||||
break
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
if lnum <= 0
|
||||
return a:current_indent
|
||||
endif
|
||||
endwhile
|
||||
" Leave indent alone if our ';' line is part of a ';'-delineated
|
||||
" aggregate (e.g., procedure args.) or first line after a block start.
|
||||
if line =~ s:AdaBlockStart || line =~ '(\s*$'
|
||||
return a:current_indent
|
||||
return a:current_indent
|
||||
endif
|
||||
if line !~ '[.=(]\s*$'
|
||||
let ind = indent(prev_lnum)
|
||||
if ind < a:current_indent
|
||||
return ind
|
||||
endif
|
||||
let ind = indent(prev_lnum)
|
||||
if ind < a:current_indent
|
||||
return ind
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
" Fallback - just use current one
|
||||
@ -159,11 +159,11 @@ function GetAdaIndent()
|
||||
while 1
|
||||
let line = substitute( getline(lnum), s:AdaComment, '', '' )
|
||||
if line !~ '^\s*$' && line !~ '^\s*#'
|
||||
break
|
||||
break
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
if lnum <= 0
|
||||
return ind
|
||||
return ind
|
||||
endif
|
||||
endwhile
|
||||
|
||||
@ -176,15 +176,15 @@ function GetAdaIndent()
|
||||
" Check for false matches to AdaBlockStart
|
||||
let false_match = 0
|
||||
if line =~ '^\s*\(procedure\|function\|package\)\>.*\<is\s*new\>'
|
||||
" Generic instantiation
|
||||
let false_match = 1
|
||||
" Generic instantiation
|
||||
let false_match = 1
|
||||
elseif line =~ ')\s*;\s*$' || line =~ '^\([^(]*([^)]*)\)*[^(]*;\s*$'
|
||||
" forward declaration
|
||||
let false_match = 1
|
||||
" forward declaration
|
||||
let false_match = 1
|
||||
endif
|
||||
" Move indent in
|
||||
if ! false_match
|
||||
let ind = ind + &sw
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
elseif line =~ '^\s*\(case\|exception\)\>'
|
||||
" Move indent in twice (next 'when' will move back)
|
||||
@ -198,10 +198,10 @@ function GetAdaIndent()
|
||||
exe lnum
|
||||
exe 'normal! $F)%'
|
||||
if getline('.') =~ '^\s*('
|
||||
" Dire layout - use previous indent (could check for AdaComment here)
|
||||
let ind = indent( prevnonblank( line('.')-1 ) )
|
||||
" Dire layout - use previous indent (could check for AdaComment here)
|
||||
let ind = indent( prevnonblank( line('.')-1 ) )
|
||||
else
|
||||
let ind = indent('.')
|
||||
let ind = indent('.')
|
||||
endif
|
||||
exe v:lnum
|
||||
elseif line =~ '[.=(]\s*$'
|
||||
@ -227,7 +227,7 @@ function GetAdaIndent()
|
||||
elseif continuation && line =~ '^\s*('
|
||||
" Don't do this if we've already indented due to the previous line
|
||||
if ind == initind
|
||||
let ind = ind + &sw
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
elseif line =~ '^\s*\(begin\|is\)\>'
|
||||
let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' )
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: automake
|
||||
" Language: automake
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
" Vim indent file
|
||||
" Language: Ch
|
||||
" Maintainer: SoftIntegration, Inc. <info@softintegration.com>
|
||||
" URL: http://www.softintegration.com/download/vim/indent/ch.vim
|
||||
" Last change: 2003 Aug 05
|
||||
" Created based on cpp.vim
|
||||
" Maintainer: SoftIntegration, Inc. <info@softintegration.com>
|
||||
" URL: http://www.softintegration.com/download/vim/indent/ch.vim
|
||||
" Last change: 2006 Apr 30
|
||||
" Created based on cpp.vim
|
||||
"
|
||||
" Ch is a C/C++ interpreter with many high level extensions
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
" =============================================================================
|
||||
"
|
||||
"
|
||||
" Program: CMake - Cross-Platform Makefile Generator
|
||||
" Module: $RCSfile$
|
||||
" Language: VIM
|
||||
" Date: $Date$
|
||||
" Version: $Revision$
|
||||
"
|
||||
"
|
||||
" =============================================================================
|
||||
|
||||
" Vim indent file
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
" Vim indent file
|
||||
" Language: Autoconf configure.{ac,in} file
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Language: Autoconf configure.{ac,in} file
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
" TODO: how about nested [()]'s in one line
|
||||
" what's wrong with '\\\@!'?
|
||||
" TODO: how about nested [()]'s in one line
|
||||
" what's wrong with '\\\@!'?
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/sh.vim " will set b:did_indent
|
||||
runtime! indent/sh.vim " will set b:did_indent
|
||||
|
||||
setlocal indentexpr=GetConfigIndent()
|
||||
setlocal indentkeys=!^F,o,O,=then,=do,=else,=elif,=esac,=fi,=fin,=fil,=done
|
||||
|
||||
@ -22,12 +22,12 @@ function s:prevnonblanknoncomment(lnum)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\*/'
|
||||
while lnum > 1 && line !~ '/\*'
|
||||
let lnum -= 1
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
if line =~ '^\s*/\*'
|
||||
let lnum -= 1
|
||||
let lnum -= 1
|
||||
else
|
||||
break
|
||||
break
|
||||
endif
|
||||
else
|
||||
break
|
||||
@ -45,13 +45,13 @@ function s:count_braces(lnum, count_open)
|
||||
while i != -1
|
||||
if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'css\%(Comment\|StringQ\{1,2}\)'
|
||||
if line[i] == '{'
|
||||
let n_open += 1
|
||||
let n_open += 1
|
||||
elseif line[i] == '}'
|
||||
if n_open > 0
|
||||
let n_open -= 1
|
||||
else
|
||||
let n_close += 1
|
||||
endif
|
||||
if n_open > 0
|
||||
let n_open -= 1
|
||||
else
|
||||
let n_close += 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let i = match(line, pattern, i + 1)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: DocBook Documentation Format
|
||||
" Language: DocBook Documentation Format
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: Eterm configuration file
|
||||
" Language: Eterm configuration file
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
" Description: html indenter
|
||||
" Author: Johannes Zellner <johannes@zellner.org>
|
||||
" Last Change: Tue, 27 Apr 2004 10:28:39 CEST
|
||||
" Globals: g:html_indent_tags -- indenting tags
|
||||
" Globals: g:html_indent_tags -- indenting tags
|
||||
" g:html_indent_strict -- inhibit 'O O' elements
|
||||
" g:html_indent_strict_table -- inhibit 'O -' elements
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
" Vim indent file
|
||||
" Language: Makefile
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Language: Makefile
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-26
|
||||
|
||||
if exists("b:did_indent")
|
||||
@ -22,7 +22,7 @@ let s:assignment_rx = '^\s*\h\w*\s*+\==\s*\zs.*\\$'
|
||||
|
||||
" TODO: Deal with comments, string, and all kinds of other crap, e.g., defines.
|
||||
" TODO: Unwrap the whole logic of this function into something that requires a
|
||||
" lot less “return”s.
|
||||
" lot less 'return's.
|
||||
function GetMakeIndent()
|
||||
let lnum = v:lnum - 1
|
||||
if lnum == 0
|
||||
@ -30,92 +30,92 @@ function GetMakeIndent()
|
||||
endif
|
||||
|
||||
" Figure out if the previous line is part of a rule or not. If it is, then
|
||||
" we more or less just indent by a ‘tabstop’, the previous’ lines indent, or
|
||||
" we more or less just indent by a 'tabstop', the previous' lines indent, or
|
||||
" remove all indent if the current line is itself a rule. Also, if the line
|
||||
" in question is part of a continuation-line set constituting the rule line
|
||||
" itself, we indent by either a ‘shiftwidth’, if the line is the first in the
|
||||
" itself, we indent by either a 'shiftwidth', if the line is the first in the
|
||||
" continuation, or use the indent of the previous line, if not.
|
||||
while lnum > 0
|
||||
let line = getline(lnum)
|
||||
if line[0] != "\t"
|
||||
" We found a non-shell-command line, i.e., one that doesn’t have a
|
||||
" We found a non-shell-command line, i.e., one that doesn't have a
|
||||
" leading tab.
|
||||
if line =~ s:rule_rx
|
||||
" The line looks like a rule line, so we must therefore either be inside a
|
||||
" rule or we are a continuation line to that rule line.
|
||||
if line =~ s:continuation_rx
|
||||
" Ah, the rule line was continued, so look up the last continuation
|
||||
" line that’s above the current line.
|
||||
while line =~ s:continuation_rx && lnum < v:lnum
|
||||
let lnum += 1
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
let lnum -= 1
|
||||
let line = getline(lnum)
|
||||
endif
|
||||
" The line looks like a rule line, so we must therefore either be inside a
|
||||
" rule or we are a continuation line to that rule line.
|
||||
if line =~ s:continuation_rx
|
||||
" Ah, the rule line was continued, so look up the last continuation
|
||||
" line that's above the current line.
|
||||
while line =~ s:continuation_rx && lnum < v:lnum
|
||||
let lnum += 1
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
let lnum -= 1
|
||||
let line = getline(lnum)
|
||||
endif
|
||||
|
||||
" If the line that we’ve found is right above the current line, deal
|
||||
" with it specifically.
|
||||
if lnum == v:lnum - 1
|
||||
" If it was continued, indent the current line by a shiftwidth, as it
|
||||
" is the first to follow it. Otherwise, depending on if the current
|
||||
" line is a rule line, i.e, a rule line following another rule line,
|
||||
" then indent to the left margin. Otherwise, the current line is the
|
||||
" first shell-command line in the rule, so indent by a ‘tabstop’
|
||||
if line =~ s:continuation_rx
|
||||
return &sw
|
||||
else
|
||||
return getline(v:lnum) =~ s:rule_rx ? 0 : &ts
|
||||
endif
|
||||
else
|
||||
" If the previous line was a continuation line, then unless it was
|
||||
" itself a part of a continuation line, add a ‘shiftwidth’’s worth of
|
||||
" indent. Otherwise, just use the indent of the previous line.
|
||||
" Otherwise, if the previous line wasn’t a continuation line, check
|
||||
" if the one above it was. If it was then indent to whatever level
|
||||
" the “owning” line had. Otherwise, indent to the previous line’s
|
||||
" level.
|
||||
let lnum = v:lnum - 1
|
||||
let line = getline(lnum)
|
||||
if line =~ s:continuation_rx
|
||||
let pnum = v:lnum - 2
|
||||
let pine = getline(pnum)
|
||||
if pine =~ s:continuation_rx
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
else
|
||||
let lnum = v:lnum - 2
|
||||
let line = getline(lnum)
|
||||
if line =~ s:continuation_rx
|
||||
while lnum > 0
|
||||
if line !~ s:continuation_rx
|
||||
let lnum += 1
|
||||
let line = getline(lnum)
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
" We’ve found the owning line. Indent to it’s level.
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(v:lnum - 1)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
" If the line that we've found is right above the current line, deal
|
||||
" with it specifically.
|
||||
if lnum == v:lnum - 1
|
||||
" If it was continued, indent the current line by a shiftwidth, as it
|
||||
" is the first to follow it. Otherwise, depending on if the current
|
||||
" line is a rule line, i.e, a rule line following another rule line,
|
||||
" then indent to the left margin. Otherwise, the current line is the
|
||||
" first shell-command line in the rule, so indent by a 'tabstop'
|
||||
if line =~ s:continuation_rx
|
||||
return &sw
|
||||
else
|
||||
return getline(v:lnum) =~ s:rule_rx ? 0 : &ts
|
||||
endif
|
||||
else
|
||||
" If the previous line was a continuation line, then unless it was
|
||||
" itself a part of a continuation line, add a 'shiftwidth''s worth of
|
||||
" indent. Otherwise, just use the indent of the previous line.
|
||||
" Otherwise, if the previous line wasn't a continuation line, check
|
||||
" if the one above it was. If it was then indent to whatever level
|
||||
" the 'owning' line had. Otherwise, indent to the previous line's
|
||||
" level.
|
||||
let lnum = v:lnum - 1
|
||||
let line = getline(lnum)
|
||||
if line =~ s:continuation_rx
|
||||
let pnum = v:lnum - 2
|
||||
let pine = getline(pnum)
|
||||
if pine =~ s:continuation_rx
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
else
|
||||
let lnum = v:lnum - 2
|
||||
let line = getline(lnum)
|
||||
if line =~ s:continuation_rx
|
||||
while lnum > 0
|
||||
if line !~ s:continuation_rx
|
||||
let lnum += 1
|
||||
let line = getline(lnum)
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
" We've found the owning line. Indent to it's level.
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(v:lnum - 1)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
" The line wasn’t a rule line, so the current line is part of a series
|
||||
" of tab-indented lines that don’t belong to any rule.
|
||||
" The line wasn't a rule line, so the current line is part of a series
|
||||
" of tab-indented lines that don't belong to any rule.
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
|
||||
" If the line before the one we are currently indenting ended with a
|
||||
" continuation, then try to figure out what “owns” that line and indent
|
||||
" continuation, then try to figure out what 'owns' that line and indent
|
||||
" appropriately.
|
||||
let lnum = v:lnum - 1
|
||||
let line = getline(lnum)
|
||||
@ -124,34 +124,34 @@ function GetMakeIndent()
|
||||
if line =~ s:assignment_rx
|
||||
" The previous line is a continuation line that begins a variable-
|
||||
" assignment expression, so set the indent to just beyond the whitespace
|
||||
" following the assignment operator (‘=’).
|
||||
" following the assignment operator ('=').
|
||||
call cursor(lnum, 1)
|
||||
if search(s:assignment_rx, 'W') != 0
|
||||
let indent = virtcol('.') - 1
|
||||
let indent = virtcol('.') - 1
|
||||
endif
|
||||
endif
|
||||
|
||||
" The previous line didn’t constitute an assignment, so just indent to
|
||||
|
||||
" The previous line didn't constitute an assignment, so just indent to
|
||||
" whatever level it had.
|
||||
return indent
|
||||
endif
|
||||
|
||||
" If the line above the line above the current line ended was continued,
|
||||
" then the line above the current line was part of a continued line. Find
|
||||
" the “owning” line and indent to its level.
|
||||
" the 'owning' line and indent to its level.
|
||||
let lnum = v:lnum - 2
|
||||
let line = getline(lnum)
|
||||
if line =~ s:continuation_rx
|
||||
while lnum > 0
|
||||
if line !~ s:continuation_rx
|
||||
let lnum += 1
|
||||
let line = getline(lnum)
|
||||
break
|
||||
let lnum += 1
|
||||
let line = getline(lnum)
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
" We’ve found the owning line. Indent to it’s level.
|
||||
" We've found the owning line. Indent to it's level.
|
||||
return indent(lnum)
|
||||
endif
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
" let filetype_m="mma"
|
||||
"
|
||||
" Credits:
|
||||
" o steve hacked this out of a random indent file in the Vim 6.1
|
||||
" o steve hacked this out of a random indent file in the Vim 6.1
|
||||
" distribution that he no longer remembers...sh.vim? Thanks!
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
@ -30,7 +30,7 @@ if exists("*GetMmaIndent")
|
||||
endif
|
||||
|
||||
function GetMmaIndent()
|
||||
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if v:lnum == 0
|
||||
return 0
|
||||
@ -38,21 +38,21 @@ function GetMmaIndent()
|
||||
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
" use indenting as a base
|
||||
|
||||
" use indenting as a base
|
||||
let ind = indent(v:lnum)
|
||||
let lnum = v:lnum
|
||||
|
||||
|
||||
" if previous line has an unmatched bracket, or ( indent.
|
||||
" doesn't do multiple parens/blocks/etc...
|
||||
|
||||
|
||||
" also, indent only if this line if this line isn't starting a new
|
||||
" block... TODO - fix this with indentkeys?
|
||||
if getline(v:lnum-1) =~ '\\\@<!\%(\[[^\]]*\|([^)]*\|{[^}]*\)$' && getline(v:lnum) !~ '\s\+[\[({]'
|
||||
let ind = ind+&sw
|
||||
endif
|
||||
|
||||
" if this line had unmatched closing block,
|
||||
" if this line had unmatched closing block,
|
||||
" indent to the matching opening block
|
||||
if getline(v:lnum) =~ '[^[]*]\s*$'
|
||||
" move to the closing bracket
|
||||
|
||||
@ -32,4 +32,4 @@ call GenericAllStmts()
|
||||
"
|
||||
" BUGS: You tell me! Probably. I just haven't found one yet or haven't been
|
||||
" told about one.
|
||||
"
|
||||
"
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
" Vim indent file
|
||||
" Language: OCaml
|
||||
" Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org>
|
||||
" Mike Leary <leary@nwlink.com>
|
||||
" Markus Mottl <markus.mottl@gmail.com>
|
||||
" URL: http://www.ocaml.info/vim/indent/ocaml.vim
|
||||
" Last Change: 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
|
||||
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
|
||||
" 2005 Apr 11 - Fixed an indentation bug concerning "let" (MM)
|
||||
" Maintainers: Jean-Francois Yuen <jfyuen@happycoders.org>
|
||||
" Mike Leary <leary@nwlink.com>
|
||||
" Markus Mottl <markus.mottl@gmail.com>
|
||||
" URL: http://www.ocaml.info/vim/indent/ocaml.vim
|
||||
" Last Change: 2006 Apr 30
|
||||
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
|
||||
" 2005 Apr 11 - Fixed an indentation bug concerning "let" (MM)
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
" Language: PHP
|
||||
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
|
||||
" URL: http://www.2072productions.com/vim/indent/php.vim
|
||||
" Last Change: 2006 January 15th
|
||||
" Last Change: 2006 Apr 30
|
||||
" Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php
|
||||
" Version: 1.23
|
||||
"
|
||||
@ -10,7 +10,7 @@
|
||||
"
|
||||
" For a complete change log and fully commented code, download the script on
|
||||
" 2072productions.com at the URI provided above.
|
||||
"
|
||||
"
|
||||
" If you find a bug, please e-mail me at John.wellesz (AT) teaser (DOT) fr
|
||||
" with an example of code that breaks the algorithm.
|
||||
"
|
||||
@ -23,9 +23,9 @@
|
||||
"
|
||||
"
|
||||
" In the case you have syntax errors in your script such as end of HereDoc
|
||||
" tags not at col 1 you'll have to indent your file 2 times (This script
|
||||
" tags not at col 1 you'll have to indent your file 2 times (This script
|
||||
" will automatically put HereDoc end tags at col 1).
|
||||
"
|
||||
"
|
||||
"
|
||||
" NOTE: If you are editing file in Unix file format and that (by accident)
|
||||
" there are '\r' before new lines, this script won't be able to proceed
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
" Options: PHP_autoformatcomment = 0 to not enable autoformating of comment by
|
||||
" default, if set to 0, this script will let the 'formatoptions' setting intact.
|
||||
"
|
||||
"
|
||||
" Options: PHP_default_indenting = # of sw (default is 0), # of sw will be
|
||||
" added to the indent of each line of PHP code.
|
||||
"
|
||||
@ -116,7 +116,7 @@ let b:UserIsTypingComment = 0
|
||||
let b:optionsset = 0
|
||||
|
||||
setlocal nosmartindent
|
||||
setlocal noautoindent
|
||||
setlocal noautoindent
|
||||
setlocal nocindent
|
||||
setlocal nolisp
|
||||
|
||||
@ -141,13 +141,13 @@ let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
|
||||
|
||||
|
||||
function! GetLastRealCodeLNum(startline) " {{{
|
||||
|
||||
|
||||
let lnum = a:startline
|
||||
|
||||
|
||||
if b:GetLastRealCodeLNum_ADD && b:GetLastRealCodeLNum_ADD == lnum + 1
|
||||
let lnum = b:GetLastRealCodeLNum_ADD
|
||||
endif
|
||||
|
||||
|
||||
let old_lnum = lnum
|
||||
|
||||
while lnum > 1
|
||||
@ -194,7 +194,7 @@ function! GetLastRealCodeLNum(startline) " {{{
|
||||
let lnum = lnum - 1
|
||||
endwhile
|
||||
else
|
||||
break
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
@ -312,7 +312,7 @@ function! ResetOptions()
|
||||
if b:PHP_autoformatcomment
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
|
||||
|
||||
|
||||
setlocal formatoptions-=t
|
||||
setlocal formatoptions+=q
|
||||
setlocal formatoptions+=r
|
||||
@ -341,7 +341,7 @@ function! GetPhpIndent()
|
||||
|
||||
let cline = getline(v:lnum)
|
||||
|
||||
if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
|
||||
if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
|
||||
if b:PHP_indentbeforelast
|
||||
let b:PHP_indentinghuge = 1
|
||||
echom 'Large indenting detected, speed optimizations engaged'
|
||||
@ -456,7 +456,7 @@ function! GetPhpIndent()
|
||||
let b:InPHPcode_and_script = 1
|
||||
endif
|
||||
|
||||
elseif last_line =~? '<<<\a\w*$'
|
||||
elseif last_line =~? '<<<\a\w*$'
|
||||
let b:InPHPcode = 0
|
||||
let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\(\a\w*\)\c', '^\\s*\1;$', '')
|
||||
|
||||
@ -470,7 +470,7 @@ function! GetPhpIndent()
|
||||
endif
|
||||
endif " }}}
|
||||
|
||||
|
||||
|
||||
if !b:InPHPcode && !b:InPHPcode_and_script
|
||||
return -1
|
||||
endif
|
||||
@ -512,7 +512,7 @@ function! GetPhpIndent()
|
||||
return 0
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*?>' && cline !~# '<?'
|
||||
if cline =~ '^\s*?>' && cline !~# '<?'
|
||||
return 0
|
||||
endif
|
||||
|
||||
@ -561,7 +561,7 @@ function! GetPhpIndent()
|
||||
|
||||
let defaultORcase = '^\s*\%(default\|case\).*:'
|
||||
|
||||
if last_line =~ '[;}]'.endline && last_line !~# defaultORcase
|
||||
if last_line =~ '[;}]'.endline && last_line !~# defaultORcase
|
||||
if ind==b:PHP_default_indenting
|
||||
return b:PHP_default_indenting
|
||||
elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline
|
||||
@ -592,7 +592,7 @@ function! GetPhpIndent()
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
|
||||
return ind
|
||||
return ind
|
||||
endif
|
||||
|
||||
let last_line_num = last_line_num - 1
|
||||
@ -644,7 +644,7 @@ function! GetPhpIndent()
|
||||
break
|
||||
endif
|
||||
|
||||
if one_ahead_indent == two_ahead_indent || last_line_num < 1
|
||||
if one_ahead_indent == two_ahead_indent || last_line_num < 1
|
||||
if previous_line =~# '[;}]'.endline || last_line_num < 1
|
||||
break
|
||||
endif
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
" Language: Python
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Original Author: David Bustos <bustos@caltech.edu>
|
||||
" Last Change: 2006 Apr 22
|
||||
" Last Change: 2006 Apr 30
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
@ -27,7 +27,7 @@ endif
|
||||
let s:maxoff = 50 " maximum number of lines to look backwards for ()
|
||||
|
||||
function GetPythonIndent(lnum)
|
||||
|
||||
|
||||
" If this line is explicitly joined: If the previous line was also joined,
|
||||
" line it up with that one, otherwise add two 'shiftwidth'
|
||||
if getline(a:lnum - 1) =~ '\\$'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: readline configuration file
|
||||
" Language: readline configuration file
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: reStructuredText Documentation Format
|
||||
" Language: reStructuredText Documentation Format
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
@ -40,7 +40,7 @@ function GetRSTIndent()
|
||||
let ind = ind - 2
|
||||
elseif line =~ '^\s*\d\+\.\s'
|
||||
let ind = ind - matchend(substitute(line, '^\s*', '', ''),
|
||||
\ '\d\+\.\s\+')
|
||||
\ '\d\+\.\s\+')
|
||||
elseif line =~ '^\s*\.\.'
|
||||
let ind = ind - 3
|
||||
else
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: Shell Script
|
||||
" Language: Shell Script
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
@ -30,8 +30,8 @@ function GetShIndent()
|
||||
let ind = indent(lnum)
|
||||
let line = getline(lnum)
|
||||
if line =~ '^\s*\(if\|then\|do\|else\|elif\|case\|while\|until\|for\)\>'
|
||||
\ || line =~ '^\s*\<\k\+\>\s*()\s*{'
|
||||
\ || line =~ '^\s*{'
|
||||
\ || line =~ '^\s*\<\k\+\>\s*()\s*{'
|
||||
\ || line =~ '^\s*{'
|
||||
if line !~ '\(esac\|fi\|done\)\>\s*$' && line !~ '}\s*$'
|
||||
let ind = ind + &sw
|
||||
endif
|
||||
@ -41,7 +41,7 @@ function GetShIndent()
|
||||
" Retain the indentation level if line matches fin (for find)
|
||||
let line = getline(v:lnum)
|
||||
if (line =~ '^\s*\(then\|do\|else\|elif\|esac\|fi\|done\)\>' || line =~ '^\s*}')
|
||||
\ && line !~ '^\s*fi[ln]\>'
|
||||
\ && line !~ '^\s*fi[ln]\>'
|
||||
let ind = ind - &sw
|
||||
endif
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
" Vim indent file loader
|
||||
" Language: SQL
|
||||
" Language: SQL
|
||||
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||
" Last Change: Thu Sep 15 2005 10:27:51 AM
|
||||
" Version: 1.0
|
||||
" Download: http://vim.sourceforge.net/script.php?script_id=495
|
||||
|
||||
" Description: Checks for a:
|
||||
" buffer local variable,
|
||||
" global variable,
|
||||
" buffer local variable,
|
||||
" global variable,
|
||||
" If the above exist, it will source the type specified.
|
||||
" If none exist, it will source the default sqlanywhere.vim file.
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: SQL
|
||||
" Language: SQL
|
||||
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||
" Last Change: Wed Sep 14 2005 10:21:15 PM
|
||||
" Version: 1.4
|
||||
@ -10,7 +10,7 @@
|
||||
" Anywhere (ASA). Test indenting was done with ASA stored procedures and
|
||||
" fuctions and Oracle packages which contain stored procedures and
|
||||
" functions.
|
||||
" This has not been tested against Microsoft SQL Server or
|
||||
" This has not been tested against Microsoft SQL Server or
|
||||
" Sybase Adaptive Server Enterprise (ASE) which use the Transact-SQL
|
||||
" syntax. That syntax does not have end tags for IF's, which makes
|
||||
" indenting more difficult.
|
||||
@ -32,7 +32,7 @@ setlocal indentkeys-=:
|
||||
setlocal indentkeys-=0#
|
||||
setlocal indentkeys-=e
|
||||
|
||||
" This indicates formatting should take place when one of these
|
||||
" This indicates formatting should take place when one of these
|
||||
" expressions is used. These expressions would normally be something
|
||||
" you would type at the BEGINNING of a line
|
||||
" SQL is generally case insensitive, so this files assumes that
|
||||
@ -40,7 +40,7 @@ setlocal indentkeys-=e
|
||||
" an indent right, since the SQLBlockStart is used for those keywords
|
||||
setlocal indentkeys+==~end,=~else,=~elseif,=~elsif,0=~when,0=)
|
||||
|
||||
" GetSQLIndent is executed whenever one of the expressions
|
||||
" GetSQLIndent is executed whenever one of the expressions
|
||||
" in the indentkeys is typed
|
||||
setlocal indentexpr=GetSQLIndent()
|
||||
|
||||
@ -51,7 +51,7 @@ endif
|
||||
|
||||
" List of all the statements that start a new block.
|
||||
" These are typically words that start a line.
|
||||
" IS is excluded, since it is difficult to determine when the
|
||||
" IS is excluded, since it is difficult to determine when the
|
||||
" ending block is (especially for procedures/functions).
|
||||
let s:SQLBlockStart = '^\s*\%('.
|
||||
\ 'if\|else\|elseif\|elsif\|'.
|
||||
@ -114,7 +114,7 @@ function s:CheckToIgnoreRightParan( prev_lnum, num_levels )
|
||||
break
|
||||
endif
|
||||
|
||||
if matching_paran == lnum
|
||||
if matching_paran == lnum
|
||||
" This was not an unmatched parantenses, start the search again
|
||||
" again after this column
|
||||
" echom 'CTIRP - same line match, ignoring'
|
||||
@ -173,9 +173,9 @@ function s:GetStmtStarterIndent( keyword, curr_lnum )
|
||||
elseif a:keyword =~? 'when'
|
||||
exec 'normal! ^'
|
||||
let matching_lnum = searchpair(
|
||||
\ '\%(\<end\s\+\)\@<!\<case\>\|\<exception\>\|\<merge\>',
|
||||
\ '',
|
||||
\ '\%(\%(\<when\s\+others\>\)\|\%(\<end\s\+case\>\)\)',
|
||||
\ '\%(\<end\s\+\)\@<!\<case\>\|\<exception\>\|\<merge\>',
|
||||
\ '',
|
||||
\ '\%(\%(\<when\s\+others\>\)\|\%(\<end\s\+case\>\)\)',
|
||||
\ 'bW',
|
||||
\ 'IsColComment(line("."), col(".")) == 1')
|
||||
exec 'normal! $'
|
||||
@ -193,10 +193,10 @@ endfunction
|
||||
" Check if the line is a comment
|
||||
function IsLineComment(lnum)
|
||||
let rc = synIDattr(
|
||||
\ synID(a:lnum,
|
||||
\ synID(a:lnum,
|
||||
\ match(getline(a:lnum), '\S')+1, 0)
|
||||
\ , "name")
|
||||
\ =~? "comment"
|
||||
\ , "name")
|
||||
\ =~? "comment"
|
||||
|
||||
return rc
|
||||
endfunction
|
||||
@ -204,8 +204,8 @@ endfunction
|
||||
|
||||
" Check if the column is a comment
|
||||
function IsColComment(lnum, cnum)
|
||||
let rc = synIDattr(synID(a:lnum, a:cnum, 0), "name")
|
||||
\ =~? "comment"
|
||||
let rc = synIDattr(synID(a:lnum, a:cnum, 0), "name")
|
||||
\ =~? "comment"
|
||||
|
||||
return rc
|
||||
endfunction
|
||||
@ -214,7 +214,7 @@ endfunction
|
||||
" Check if the column is a comment
|
||||
function ModuloIndent(ind)
|
||||
let ind = a:ind
|
||||
|
||||
|
||||
if ind > 0
|
||||
let modulo = ind % &shiftwidth
|
||||
|
||||
@ -229,7 +229,7 @@ endfunction
|
||||
|
||||
" Find correct indent of a new line based upon the previous line
|
||||
function GetSQLIndent()
|
||||
let lnum = v:lnum
|
||||
let lnum = v:lnum
|
||||
let ind = indent(lnum)
|
||||
|
||||
" If the current line is a comment, leave the indent as is
|
||||
@ -246,7 +246,7 @@ function GetSQLIndent()
|
||||
return ind
|
||||
endif
|
||||
|
||||
if IsLineComment(prevlnum) == 1
|
||||
if IsLineComment(prevlnum) == 1
|
||||
if getline(v:lnum) =~ '^\s*\*'
|
||||
let ind = ModuloIndent(indent(prevlnum))
|
||||
return ind + 1
|
||||
@ -269,13 +269,13 @@ function GetSQLIndent()
|
||||
" endif
|
||||
" endwhile
|
||||
|
||||
" echom 'PREVIOUS INDENT: ' . indent(prevlnum) . ' LINE: ' . getline(prevlnum)
|
||||
" echom 'PREVIOUS INDENT: ' . indent(prevlnum) . ' LINE: ' . getline(prevlnum)
|
||||
|
||||
" This is the line you just hit return on, it is not the current line
|
||||
" which is new and empty
|
||||
" Based on this line, we can determine how much to indent the new
|
||||
" line
|
||||
|
||||
|
||||
" Get default indent (from prev. line)
|
||||
let ind = indent(prevlnum)
|
||||
let prevline = getline(prevlnum)
|
||||
@ -300,7 +300,7 @@ function GetSQLIndent()
|
||||
" let num_unmatched_right = s:CountUnbalancedParan( prevline, ')' )
|
||||
endif
|
||||
if num_unmatched_left > 0
|
||||
" There is a open left paranethesis
|
||||
" There is a open left paranethesis
|
||||
" increase indent
|
||||
let ind = ind + ( &sw * num_unmatched_left )
|
||||
elseif num_unmatched_right > 0
|
||||
@ -331,7 +331,7 @@ function GetSQLIndent()
|
||||
let line = getline(v:lnum)
|
||||
|
||||
if line =~? '^\s*els'
|
||||
" Any line when you type else will automatically back up one
|
||||
" Any line when you type else will automatically back up one
|
||||
" ident level (ie else, elseif, elsif)
|
||||
let ind = ind - &sw
|
||||
" echom 'curr - else - indent ' . ind
|
||||
@ -356,11 +356,11 @@ function GetSQLIndent()
|
||||
" If the line ends in a ), then reduce the indent
|
||||
" This catches items like:
|
||||
" CREATE TABLE T1(
|
||||
" c1 int,
|
||||
" c1 int,
|
||||
" c2 int
|
||||
" );
|
||||
" But we do not want to unindent a line like:
|
||||
" IF ( c1 = 1
|
||||
" IF ( c1 = 1
|
||||
" AND c2 = 3 ) THEN
|
||||
" let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
|
||||
" if num_unmatched_right > 0
|
||||
|
||||
@ -36,13 +36,13 @@ function s:count_braces(lnum, count_open)
|
||||
while i != -1
|
||||
if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'tcl\%(Comment\|String\)'
|
||||
if line[i] == '{'
|
||||
let n_open += 1
|
||||
let n_open += 1
|
||||
elseif line[i] == '}'
|
||||
if n_open > 0
|
||||
let n_open -= 1
|
||||
else
|
||||
let n_close += 1
|
||||
endif
|
||||
if n_open > 0
|
||||
let n_open -= 1
|
||||
else
|
||||
let n_close += 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let i = match(line, pattern, i + 1)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: XFree86 Configuration File
|
||||
" Language: XFree86 Configuration File
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: YACC input file
|
||||
" Language: YACC input file
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" Vim indent file
|
||||
" Language: Zsh Shell Script
|
||||
" Language: Zsh Shell Script
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2006-04-19
|
||||
|
||||
|
||||
Reference in New Issue
Block a user