updated for version 7.0097

This commit is contained in:
Bram Moolenaar
2005-06-29 22:40:58 +00:00
parent 24bbcfe8fe
commit 42eeac3552
123 changed files with 6496 additions and 3288 deletions

View File

@ -1,11 +1,11 @@
" Vim indent file
" Language: automake
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/automake/
" Latest Revision: 2004-04-25
" arch-tag: 9a2af48c-48d4-4bae-82c3-c801bc9d1976
" Language: automake
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
if exists("b:did_indent")
finish
endif
" same as makefile indenting for now.
source <sfile>:p:h/make.vim
" vim: set sts=2 sw=2:
runtime! indent/make.vim

View File

@ -1,18 +1,17 @@
" Vim indent file
" Language: Autoconf configure.{ac,in} file
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/config/
" Latest Revision: 2004-04-25
" arch-tag: 7779c341-796f-408e-80e4-a55c26b519a4
" TODO: how about nested [()]'s in one line
" what's wrong with '\\\@!'?
" Language: Autoconf configure.{ac,in} file
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" URL: http://www.pcppopper.org/vim/indent/pcp/config/
" Latest Revision: 2005-06-29
" 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
source <sfile>:p:h/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

View File

@ -1,79 +1,54 @@
" Vim indent file
" Language: CSS
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/css/
" Latest Revision: 2004-04-25
" arch-tag: ccfd77a0-1c9a-43f7-a407-bbe704541442
" Language: CSS
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetCSSIndent()
setlocal indentkeys-=:,0# indentkeys-=e
setlocal indentkeys=0{,0},!^F,o,O
" Only define the function once.
if exists("*GetCSSIndent")
finish
endif
function! s:LookupLine(lnum)
" find a non-blank line above the current line
function s:LookupLine(lnum)
let lnum = prevnonblank(a:lnum - 1)
while lnum > 0
let line = getline(lnum)
if lnum == 0
return 0
endif
if line =~ '\*/'
while lnum > 0 && line !~ '/\*'
let lnum -= 1
let line = getline(lnum)
endwhile
endif
let line = getline(lnum)
" if the line has an end comment sequence we need to find a line
" that isn't affected by the comment.
if line =~ '\*/'
while line !~ '/\*'
let lnum = lnum - 1
let line = getline(lnum)
endwhile
endif
" if the line we found only contained the comment and whitespace
" we need to find another line to use...
if line =~ '^\s*/\*'
return s:LookupLine(lnum)
else
return lnum
endif
if line !~ '^\s*/\*'
return lnum
end
endwhile
return lnum
endfunction
function GetCSSIndent()
let lnum = s:LookupLine(v:lnum)
let lnum = prevnonblank(v:lnum - 1)
if lnum == 0
return 0
endif
" remove commented stuff from line
let line = substitute(getline(lnum), '/\*.\*/', '', 'eg')
let ind = indent(lnum)
" check for opening brace on the previous line
" skip if it also contains a closing brace...
if line =~ '{\(.*}\)\@!'
if substitute(getline(lnum), '/\*.*', '', 'e') =~ '{\(.*}\)\@!'
let ind = ind + &sw
endif
let line = getline(v:lnum)
" check for closing brace first on current line
if line =~ '^\s*}'
let ind = ind - &sw
if getline(v:lnum) =~ '^\s*}'
let ind = ind - &sw
endif
return ind
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,12 +1,10 @@
" Vim indent file
" Language: DocBook Documentation Format
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/docbk/
" Latest Revision: 2004-05-22
" arch-tag: 3d073af7-1d69-42a2-99ad-9a49a21eb28f
" Language: DocBook Documentation Format
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
if exists("b:did_indent")
finish
finish
endif
" Same as XML indenting for now.
@ -15,5 +13,3 @@ runtime! indent/xml.vim
if exists('*XmlIndentGet')
setlocal indentexpr=XmlIndentGet(v:lnum,0)
endif
" vim: set sts=2 sw=2:

View File

@ -1,49 +1,35 @@
" Vim indent file
" Language: Eterm configuration file
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/eterm/
" Latest Revision: 2004-04-25
" arch-tag: a22a92b1-c59f-4f47-8207-b21db6549b21
" Language: Eterm configuration file
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetEtermIndent()
setlocal indentkeys=!^F,o,O,=end
" Only define the function once.
if exists("*GetEtermIndent")
finish
endif
function GetEtermIndent()
" 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 line = getline(lnum)
let ind = indent(lnum)
if line =~ '^\s*begin\>'
if getline(lnum) =~ '^\s*begin\>'
let ind = ind + &sw
endif
let line = getline(v:lnum)
" Check for closing brace on current line
if line =~ '^\s*end\>'
if getline(v:lnum) =~ '^\s*end\>'
let ind = ind - &sw
endif
return ind
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,7 +1,7 @@
" Vim indent file
" Language: ld(1) script
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-28
" Latest Revision: 2005-06-29
if exists("b:did_indent")
finish

View File

@ -1,21 +1,16 @@
" Vim indent file
" Language: Makefile
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/make/
" Latest Revision: 2004-04-25
" arch-tag: b539e147-a05c-4860-98af-1d2436db2f4b
" Language: Makefile
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetMakeIndent()
setlocal indentkeys=!^F,o,O
" Only define the function once.
if exists("*GetMakeIndent")
finish
endif
@ -23,35 +18,28 @@ endif
function s:GetStringWidth(line, str)
let end = matchend(a:line, a:str)
let width = 0
let i = 0
while i < end
if a:line[i] != "\t"
let width = width + 1
for c in a:line
if c == "\t"
let width += &ts - (width % &ts)
else
let width = width + &ts - (width % &ts)
let width += 1
endif
let i = i + 1
endwhile
endfor
return width
endfunction
function GetMakeIndent()
if v:lnum == 1
let lnum = v:lnum - 1
if lnum == 0
return 0
endif
let ind = indent(v:lnum - 1)
let line = getline(v:lnum - 1)
let line = getline(lnum)
if line == ''
let ind = 0
elseif line =~ '^[^ \t#:][^#:]*:\{1,2}\([^=:]\|$\)'
let ind = ind + &ts
elseif line =~ '^\s*\h\w*\s*=\s*.\+\\$'
let ind = s:GetStringWidth(line, '=\s*')
return 0
elseif line =~ '^[^ \t#:][^#:]*:\{1,2}\%([^=:]\|$\)'
return indent(lnum) + &ts
elseif line =~ '^\s*\h\w*\s*+\==\s*.\+\\$'
return s:GetStringWidth(line, '+\==\s*')
endif
return ind
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,48 +1,35 @@
" Vim indent file
" Language: readline configuration file
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/readline/
" Latest Revision: 2004-04-25
" arch-tag: ee681235-3abf-4a42-8587-edabd409a980
" Language: readline configuration file
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetReadlineIndent()
setlocal indentkeys=!^F,o,O,=$else,=$endif
" Only define the function once.
if exists("*GetReadlineIndent")
finish
endif
function GetReadlineIndent()
let lnum = prevnonblank(v:lnum - 1)
if lnum == 0
return 0
endif
let line = getline(lnum)
let ind = indent(lnum)
" increase indent if previous line started with $if or $else
if line =~ '^\s*$\(if\|else\)\>'
if getline(lnum) =~ '^\s*$\(if\|else\)\>'
let ind = ind + &sw
endif
let line = getline(v:lnum)
" decrease indent if this line starts with $else or $endif
if line =~ '^\s*$\(else\|endif\)\>'
if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
let ind = ind - &sw
endif
return ind
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,28 +1,22 @@
" Vim indent file
" Language: reStructuredText Documentation Format
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/rst/
" Latest Revision: 2004-04-25
" arch-tag: 3fe10f75-24d0-4d94-a924-0ce945958104
" Language: reStructuredText Documentation Format
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetRSTIndent()
setlocal indentkeys-=:,0# indentkeys-=e
setlocal indentkeys=!^F,o,O
" Only define the function once.
if exists("*GetRSTIndent")
finish
endif
function GetRSTIndent()
let lnum = prevnonblank(v:lnum - 1)
if lnum == 0
return 0
endif
@ -46,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
@ -56,5 +50,3 @@ function GetRSTIndent()
return ind
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,33 +1,26 @@
" Vim indent file
" Language: Shell Script
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/sh/
" Latest Revision: 2004-04-25
" arch-tag: 431c7fc1-12a6-4d71-9636-1498ef56b038
" Language: Shell Script
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetShIndent()
setlocal indentkeys+==then,=do,=else,=elif,=esac,=fi,=fin,=fil,=done
setlocal indentkeys-=:,0#
" Only define the function once.
if exists("*GetShIndent")
finish
endif
set cpoptions-=C
let s:cpo_save = &cpo
set cpo&vim
function GetShIndent()
" 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
@ -37,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*\<\h\w*\>\s*()\s*{'
\ || line =~ '^\s*{'
\ || line =~ '^\s*\<\k\+\>\s*()\s*{'
\ || line =~ '^\s*{'
if line !~ '\(esac\|fi\|done\)\>\s*$' && line !~ '}\s*$'
let ind = ind + &sw
endif
@ -48,11 +41,12 @@ 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
return ind
endfunction
" vim: set sts=2 sw=2:
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -1,27 +1,21 @@
" Vim indent file
" Language: Tcl
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/tcl/
" Latest Revision: 2004-05-21
" arch-tag: 64fab1fa-d670-40ab-a191-55678f20ceb0
" Language: Tcl
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetTclIndent()
setlocal indentkeys-=:,0#
setlocal indentkeys+=0]
setlocal indentkeys=0{,0},!^F,o,O,0]
" only define the function once.
if exists("*GetTclIndent")
finish
endif
function s:PrevNonBlankNonComment(lnum)
function s:prevnonblanknoncomment(lnum)
let lnum = prevnonblank(a:lnum)
while lnum > 0
let line = getline(lnum)
@ -33,91 +27,44 @@ function s:PrevNonBlankNonComment(lnum)
return lnum
endfunction
function! GetTclIndent()
let lnum = s:PrevNonBlankNonComment(v:lnum - 1)
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, 1), 'name') !~ 'tcl\%(Comment\|String\)'
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
if lnum == 0
function GetTclIndent()
let pnum = s:prevnonblanknoncomment(v:lnum - 1)
if pnum == 0
return 0
endif
let line = getline(lnum)
let ind = indent(lnum)
let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw
if getline(pnum) =~ '\\$'
let ind += &sw
endif
" TODO: Possible improvement, check that 'begin' and 'end' aren't inside a
" comment or string. This will mess it up. As I am pressed for time and
" stuff like this is unlikely to happen I won't deal with it in this
" version.
let open = 0
let begin = match(line, '{', 0)
while begin > -1
let end = match(line, '}', begin + 1)
if end < 0
let open = open + 1
else
let tmp = match(line, '{', begin + 1)
if tmp != -1 && tmp < end
let open = open + 1
endif
endif
let begin = match(line, '{', begin + 1)
endwhile
let pnum = s:prevnonblanknoncomment(pnum - 1)
if pnum > 0 && getline(pnum) =~ '\\$'
let ind -= &sw
endif
let begin = match(line, '[', 0)
while begin > -1
let end = match(line, ']', begin + 1)
if end < 0
let open = open + 1
else
let tmp = match(line, '{', begin + 1)
if tmp != -1 && tmp < end
let open = open + 1
endif
endif
let begin = match(line, '{', begin + 1)
endwhile
let close = 0
let prev = 0
let end = matchend(line, '^\s*}.*}', prev)
while end > -1
let begin = match(line, '{', prev + 1)
if begin < 0 || begin > prev
let close = close + 1
endif
let prev = end
let end = match(line, '}', prev + 1)
endwhile
let prev = 0
let end = match(line, ']', prev)
while end > -1
let begin = match(line, '[', prev + 1)
if begin < 0 || begin > prev
let close = close + 1
endif
let prev = end
let end = match(line, ']', prev + 1)
endwhile
let ind = ind + (open - close) * &sw
let line = getline(v:lnum)
let close = 0
let prev = 0
let end = match(line, '}', prev)
while end > -1
let begin = match(line, '{', prev + 1)
if begin < 0 || begin > prev
let close = close + 1
endif
let prev = end
let end = match(line, '}', prev + 1)
endwhile
let ind = ind - close * &sw
return ind >= 0 ? ind : 0
return ind - s:count_braces(v:lnum, 0) * &sw
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,21 +1,16 @@
" Vim indent file
" Language: XFree86 Configuration File
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/xf86conf/
" Latest Revision: 2004-04-25
" arch-tag: 8a42f7b6-5088-49cf-b15b-07696a91c015
" Language: XFree86 Configuration File
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetXF86ConfIndent()
setlocal indentkeys=!^F,o,O,=End
" Only define the function once.
if exists("*GetXF86ConfIndent")
finish
endif
@ -28,15 +23,14 @@ function GetXF86ConfIndent()
endif
let ind = indent(lnum)
let line = getline(lnum)
if line =~? '^\s*\(Sub\)\=Section'
if getline(lnum) =~? '^\s*\(Sub\)\=Section\>'
let ind = ind + &sw
elseif getline(v:lnum) =~? '^\s*End'
endif
if getline(v:lnum) =~? '^\s*End\>'
let ind = ind - &sw
endif
return ind
endfunction
" vim: set sts=2 sw=2:

49
runtime/indent/xinetd.vim Normal file
View File

@ -0,0 +1,49 @@
" Vim indent file
" Language: xinetd.conf(5) configuration file
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-28
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetXinetdIndent()
setlocal indentkeys=0{,0},!^F,o,O
if exists("*GetXinetdIndent")
finish
endif
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') !~ 'ld\%(Comment\|String\)'
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 GetXinetdIndent()
let pnum = prevnonblank(v:lnum - 1)
if pnum == 0
return 0
endif
return indent(pnum) + s:count_braces(pnum, 1) * &sw
\ - s:count_braces(v:lnum, 0) * &sw
endfunction

View File

@ -1,9 +1,7 @@
" Vim indent file
" Language: YACC input file
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/yacc/
" Latest Revision: 2004-04-25
" arch-tag: 629aa719-8fe4-4787-adb7-ae94ca801610
" Language: YACC input file
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@ -40,5 +38,3 @@ function GetYaccIndent()
return ind
endfunction
" vim: set sts=2 sw=2:

View File

@ -1,11 +1,11 @@
" Vim indent file
" Language: Zsh Shell Script
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/indent/pcp/zsh/
" Latest Revision: 2004-05-22
" arch-tag: e566f55f-d8c0-4c60-b4b3-60c0dbd6dea1
" Language: Zsh Shell Script
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
if exists("b:did_indent")
finish
endif
" Same as sh indenting for now.
runtime! indent/sh.vim
" vim: set sts=2 sw=2: