Mercurial > vim
annotate runtime/indent/xinetd.vim @ 18679:fd95d4dbeb37 v8.1.2331
patch 8.1.2331: the option.c file is still very big
Commit: https://github.com/vim/vim/commit/7bae0b1bc84a95d565ffab38cf7f82ad21c656b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 21 22:14:18 2019 +0100
patch 8.1.2331: the option.c file is still very big
Problem: The option.c file is still very big.
Solution: Move a few functions to where they fit better. (Yegappan
Lakshmanan, closes #4895)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 21 Nov 2019 22:15:03 +0100 |
parents | d0a20101ecb2 |
children | 4d76b3e07c07 |
rev | line source |
---|---|
375 | 1 " Vim indent file |
11062 | 2 " Language: xinetd.conf(5) configuration file |
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se> | |
4 " Latest Revision: 2006-12-20 | |
375 | 5 |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal indentexpr=GetXinetdIndent() | |
12 setlocal indentkeys=0{,0},!^F,o,O | |
1209 | 13 setlocal nosmartindent |
375 | 14 |
15 if exists("*GetXinetdIndent") | |
16 finish | |
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 | 20 |
21 function s:count_braces(lnum, count_open) | |
22 let n_open = 0 | |
23 let n_close = 0 | |
24 let line = getline(a:lnum) | |
25 let pattern = '[{}]' | |
26 let i = match(line, pattern) | |
27 while i != -1 | |
28 if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)' | |
29 if line[i] == '{' | |
30 let n_open += 1 | |
31 elseif line[i] == '}' | |
32 if n_open > 0 | |
33 let n_open -= 1 | |
34 else | |
35 let n_close += 1 | |
36 endif | |
37 endif | |
38 endif | |
39 let i = match(line, pattern, i + 1) | |
40 endwhile | |
41 return a:count_open ? n_open : n_close | |
42 endfunction | |
43 | |
44 function GetXinetdIndent() | |
45 let pnum = prevnonblank(v:lnum - 1) | |
46 if pnum == 0 | |
47 return 0 | |
48 endif | |
49 | |
11160 | 50 return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() |
51 \ - s:count_braces(v:lnum, 0) * shiftwidth() | |
375 | 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 |