Mercurial > vim
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 |
rev | line source |
---|---|
375 | 1 " Vim indent file |
28620 | 2 " Language: xinetd.conf(5) configuration file |
3 " Maintainer: Doug Kearns <dougkearns@gmail.com> | |
4 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> | |
5 " Last Change: 2022 April 25 | |
375 | 6 |
7 if exists("b:did_indent") | |
8 finish | |
9 endif | |
10 let b:did_indent = 1 | |
11 | |
12 setlocal indentexpr=GetXinetdIndent() | |
13 setlocal indentkeys=0{,0},!^F,o,O | |
1209 | 14 setlocal nosmartindent |
375 | 15 |
28620 | 16 let b:undo_indent = "setl inde< indk< si<" |
17 | |
375 | 18 if exists("*GetXinetdIndent") |
19 finish | |
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 | 23 |
24 function s:count_braces(lnum, count_open) | |
25 let n_open = 0 | |
26 let n_close = 0 | |
27 let line = getline(a:lnum) | |
28 let pattern = '[{}]' | |
29 let i = match(line, pattern) | |
30 while i != -1 | |
31 if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)' | |
32 if line[i] == '{' | |
33 let n_open += 1 | |
34 elseif line[i] == '}' | |
35 if n_open > 0 | |
36 let n_open -= 1 | |
37 else | |
38 let n_close += 1 | |
39 endif | |
40 endif | |
41 endif | |
42 let i = match(line, pattern, i + 1) | |
43 endwhile | |
44 return a:count_open ? n_open : n_close | |
45 endfunction | |
46 | |
47 function GetXinetdIndent() | |
48 let pnum = prevnonblank(v:lnum - 1) | |
49 if pnum == 0 | |
50 return 0 | |
51 endif | |
52 | |
11160 | 53 return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() |
54 \ - s:count_braces(v:lnum, 0) * shiftwidth() | |
375 | 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 |