annotate runtime/indent/xinetd.vim @ 14160:de4575cbbb2b

Added tag v8.1.0097 for changeset c9342023ea6fe966961356f141276a7589961c21
author Christian Brabandt <cb@256bit.org>
date Fri, 22 Jun 2018 21:45:07 +0200
parents d0a20101ecb2
children 4d76b3e07c07
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
11062
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 3526
diff changeset
2 " Language: xinetd.conf(5) configuration file
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 3526
diff changeset
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 3526
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
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
18 let s:keepcpo= &cpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
19 set cpo&vim
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
20
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
21 function s:count_braces(lnum, count_open)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
22 let n_open = 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
23 let n_close = 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
24 let line = getline(a:lnum)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
25 let pattern = '[{}]'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
26 let i = match(line, pattern)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
27 while i != -1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
28 if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
29 if line[i] == '{'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
30 let n_open += 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
31 elseif line[i] == '}'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
32 if n_open > 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
33 let n_open -= 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
34 else
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
35 let n_close += 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
36 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
37 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
38 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
39 let i = match(line, pattern, i + 1)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
40 endwhile
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
41 return a:count_open ? n_open : n_close
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
42 endfunction
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
43
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
44 function GetXinetdIndent()
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
45 let pnum = prevnonblank(v:lnum - 1)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
46 if pnum == 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
47 return 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
48 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
49
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
50 return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth()
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
51 \ - s:count_braces(v:lnum, 0) * shiftwidth()
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
52 endfunction
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
53
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
54 let &cpo = s:keepcpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
55 unlet s:keepcpo