annotate runtime/indent/xinetd.vim @ 2955:f909f4f0f38c v7.3.250

updated for version 7.3.250 Problem: Python: Errors in Unicode characters not handled nicely. Solution: Add the surrogateescape error handler. (lilydjwg)
author Bram Moolenaar <bram@vim.org>
date Fri, 15 Jul 2011 15:54:44 +0200
parents 070f2ac50cf8
children dd6c2497c997
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
1 " Vim indent file
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
2 " Language: xinetd.conf(5) configuration file
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 375
diff changeset
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 839
diff changeset
4 " Latest Revision: 2006-12-20
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
5
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
6 if exists("b:did_indent")
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
7 finish
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
8 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
9 let b:did_indent = 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
10
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
11 setlocal indentexpr=GetXinetdIndent()
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
12 setlocal indentkeys=0{,0},!^F,o,O
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 839
diff changeset
13 setlocal nosmartindent
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
14
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
15 if exists("*GetXinetdIndent")
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
16 finish
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
17 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
18
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
19 function s:count_braces(lnum, count_open)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
20 let n_open = 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
21 let n_close = 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
22 let line = getline(a:lnum)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
23 let pattern = '[{}]'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
24 let i = match(line, pattern)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
25 while i != -1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
26 if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
27 if line[i] == '{'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
28 let n_open += 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
29 elseif line[i] == '}'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
30 if n_open > 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
31 let n_open -= 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
32 else
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
33 let n_close += 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
34 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
35 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
36 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
37 let i = match(line, pattern, i + 1)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
38 endwhile
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
39 return a:count_open ? n_open : n_close
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
40 endfunction
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
41
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
42 function GetXinetdIndent()
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
43 let pnum = prevnonblank(v:lnum - 1)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
44 if pnum == 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
45 return 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
46 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
47
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
48 return indent(pnum) + s:count_braces(pnum, 1) * &sw
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
49 \ - s:count_braces(v:lnum, 0) * &sw
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
50 endfunction