annotate runtime/indent/xinetd.vim @ 9408:6814811b90d5 v7.4.1985

commit https://github.com/vim/vim/commit/3b98b830017b8bf5fd270db93dfe187434df1960 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 2 21:45:17 2016 +0200 patch 7.4.1985 Problem: Missing changes in VMS build file. Solution: Use the right file name.
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Jul 2016 22:00:05 +0200
parents dd6c2497c997
children 1218c5353e2b
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
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
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
50 return indent(pnum) + s:count_braces(pnum, 1) * &sw
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
51 \ - s:count_braces(v:lnum, 0) * &sw
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