Mercurial > vim
annotate runtime/indent/xinetd.vim @ 31938:96d6d31dd66b v9.0.1301
patch 9.0.1301: virtual text below empty line not displayed
Commit: https://github.com/vim/vim/commit/9d9a20ee8799bafe9caac616fef11b7a26db6a8d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 11 13:49:01 2023 +0000
patch 9.0.1301: virtual text below empty line not displayed
Problem: Virtual text below empty line not displayed.
Solution: Adjust flags and computations. (closes https://github.com/vim/vim/issues/11959)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Feb 2023 15:00:04 +0100 |
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 |