annotate runtime/indent/xinetd.vim @ 29533:34c1f4cd0c18

Update runtime files Commit: https://github.com/vim/vim/commit/2ecbe53f452e92e941aff623f6a0b72f80e43d07 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 29 21:36:21 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Fri, 29 Jul 2022 22:45:04 +0200
parents 4d76b3e07c07
children
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
28620
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
2 " Language: xinetd.conf(5) configuration file
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
4 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
5 " Last Change: 2022 April 25
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
6
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
7 if exists("b:did_indent")
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
8 finish
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
9 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
10 let b:did_indent = 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
11
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
12 setlocal indentexpr=GetXinetdIndent()
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
13 setlocal indentkeys=0{,0},!^F,o,O
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 839
diff changeset
14 setlocal nosmartindent
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
15
28620
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
16 let b:undo_indent = "setl inde< indk< si<"
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11160
diff changeset
17
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
18 if exists("*GetXinetdIndent")
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
19 finish
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
20 endif
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
21 let s:keepcpo= &cpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
22 set cpo&vim
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
23
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
24 function s:count_braces(lnum, count_open)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
25 let n_open = 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
26 let n_close = 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
27 let line = getline(a:lnum)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
28 let pattern = '[{}]'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
29 let i = match(line, pattern)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
30 while i != -1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
31 if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
32 if line[i] == '{'
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 elseif line[i] == '}'
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
35 if n_open > 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
36 let n_open -= 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
37 else
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
38 let n_close += 1
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
39 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
40 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
41 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
42 let i = match(line, pattern, i + 1)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
43 endwhile
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
44 return a:count_open ? n_open : n_close
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
45 endfunction
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
46
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
47 function GetXinetdIndent()
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
48 let pnum = prevnonblank(v:lnum - 1)
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
49 if pnum == 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
50 return 0
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
51 endif
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
52
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
53 return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth()
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11062
diff changeset
54 \ - s:count_braces(v:lnum, 0) * shiftwidth()
375
f14cbd913415 updated for version 7.0097
vimboss
parents:
diff changeset
55 endfunction
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
56
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
57 let &cpo = s:keepcpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1209
diff changeset
58 unlet s:keepcpo