Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
xinetd.vim59 linesDownload Raw Back to indent
1" Vim indent file2" Language:		xinetd.conf(5) configuration file3" Maintainer:		Doug Kearns <dougkearns@gmail.com>4" Previous Maintainer:	Nikolai Weibull <now@bitwi.se>5" Last Change:		2022 April 256 7if exists("b:did_indent")8  finish9endif10let b:did_indent = 111 12setlocal indentexpr=GetXinetdIndent()13setlocal indentkeys=0{,0},!^F,o,O14setlocal nosmartindent15 16let b:undo_indent = "setl inde< indk< si<"17 18if exists("*GetXinetdIndent")19  finish20endif21let s:keepcpo= &cpo22set cpo&vim23 24function s:count_braces(lnum, count_open)25  let n_open = 026  let n_close = 027  let line = getline(a:lnum)28  let pattern = '[{}]'29  let i = match(line, pattern)30  while i != -131    if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)'32      if line[i] == '{'33        let n_open += 134      elseif line[i] == '}'35        if n_open > 036          let n_open -= 137        else38          let n_close += 139        endif40      endif41    endif42    let i = match(line, pattern, i + 1)43  endwhile44  return a:count_open ? n_open : n_close45endfunction46 47function GetXinetdIndent()48  let pnum = prevnonblank(v:lnum - 1)49  if pnum == 050    return 051  endif52 53  return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth()54        \ - s:count_braces(v:lnum, 0) * shiftwidth()55endfunction56 57let &cpo = s:keepcpo58unlet s:keepcpo59 
codekingpro/portable-devtools · Team Ai