/
usr
/
share
/
vim
/
vim82
/
indent
/
/usr/share/vim/vim82/indent
mkdir
upload
Name
Size
Mode
Actions
aap.vim
265
0644
edit
dl
rm
ada.vim
11234
0644
edit
dl
rm
ant.vim
290
0644
edit
dl
rm
automake.vim
243
0644
edit
dl
rm
awk.vim
7774
0644
edit
dl
rm
bash.vim
350
0644
edit
dl
rm
bib.vim
346
0644
edit
dl
rm
bst.vim
1937
0644
edit
dl
rm
bzl.vim
2925
0644
edit
dl
rm
c.vim
325
0644
edit
dl
rm
cdl.vim
4342
0644
edit
dl
rm
ch.vim
470
0644
edit
dl
rm
chaiscript.vim
1138
0644
edit
dl
rm
changelog.vim
264
0644
edit
dl
rm
clojure.vim
11557
0644
edit
dl
rm
cmake.vim
2683
0644
edit
dl
rm
cobol.vim
8832
0644
edit
dl
rm
config.vim
2222
0644
edit
dl
rm
context.vim
752
0644
edit
dl
rm
cpp.vim
329
0644
edit
dl
rm
cs.vim
1756
0644
edit
dl
rm
css.vim
1813
0644
edit
dl
rm
cucumber.vim
2678
0644
edit
dl
rm
cuda.vim
305
0644
edit
dl
rm
d.vim
572
0644
edit
dl
rm
dictconf.vim
337
0644
edit
dl
rm
dictdconf.vim
338
0644
edit
dl
rm
docbk.vim
336
0644
edit
dl
rm
dosbatch.vim
1382
0644
edit
dl
rm
dtd.vim
11954
0644
edit
dl
rm
dtrace.vim
451
0644
edit
dl
rm
dune.vim
332
0644
edit
dl
rm
dylan.vim
2770
0644
edit
dl
rm
eiffel.vim
3317
0644
edit
dl
rm
elm.vim
3277
0644
edit
dl
rm
erlang.vim
50066
0644
edit
dl
rm
eruby.vim
3016
0644
edit
dl
rm
eterm.vim
743
0644
edit
dl
rm
falcon.vim
14077
0644
edit
dl
rm
fortran.vim
7664
0644
edit
dl
rm
framescript.vim
891
0644
edit
dl
rm
gitconfig.vim
841
0644
edit
dl
rm
gitolite.vim
1277
0644
edit
dl
rm
go.vim
1673
0644
edit
dl
rm
haml.vim
2203
0644
edit
dl
rm
hamster.vim
1692
0644
edit
dl
rm
hog.vim
1892
0644
edit
dl
rm
html.vim
33651
0644
edit
dl
rm
htmldjango.vim
273
0644
edit
dl
rm
idlang.vim
1683
0644
edit
dl
rm
ishd.vim
1877
0644
edit
dl
rm
j.vim
1812
0644
edit
dl
rm
java.vim
4287
0644
edit
dl
rm
javascript.vim
15362
0644
edit
dl
rm
javascriptreact.vim
109
0644
edit
dl
rm
json.vim
4528
0644
edit
dl
rm
jsonc.vim
4727
0644
edit
dl
rm
jsp.vim
462
0644
edit
dl
rm
julia.vim
15449
0644
edit
dl
rm
ld.vim
1867
0644
edit
dl
rm
less.vim
243
0644
edit
dl
rm
lifelines.vim
638
0644
edit
dl
rm
liquid.vim
1899
0644
edit
dl
rm
lisp.vim
353
0644
edit
dl
rm
logtalk.vim
1859
0644
edit
dl
rm
lua.vim
1927
0644
edit
dl
rm
mail.vim
355
0644
edit
dl
rm
make.vim
3565
0644
edit
dl
rm
matlab.vim
4923
0644
edit
dl
rm
meson.vim
5319
0644
edit
dl
rm
mf.vim
156
0644
edit
dl
rm
mma.vim
2273
0644
edit
dl
rm
mp.vim
11321
0644
edit
dl
rm
nginx.vim
362
0644
edit
dl
rm
nsis.vim
3305
0644
edit
dl
rm
objc.vim
1646
0644
edit
dl
rm
ocaml.vim
9191
0644
edit
dl
rm
occam.vim
4700
0644
edit
dl
rm
pascal.vim
5793
0644
edit
dl
rm
perl.vim
5905
0644
edit
dl
rm
php.vim
25901
0644
edit
dl
rm
postscr.vim
1708
0644
edit
dl
rm
pov.vim
2662
0644
edit
dl
rm
prolog.vim
1864
0644
edit
dl
rm
ps1.vim
410
0644
edit
dl
rm
pyrex.vim
326
0644
edit
dl
rm
python.vim
6984
0644
edit
dl
rm
r.vim
14037
0644
edit
dl
rm
raku.vim
3416
0644
edit
dl
rm
raml.vim
285
0644
edit
dl
rm
readline.vim
786
0644
edit
dl
rm
rhelp.vim
2840
0644
edit
dl
rm
rmd.vim
2187
0644
edit
dl
rm
rnoweb.vim
1087
0644
edit
dl
rm
rpl.vim
1863
0644
edit
dl
rm
rrst.vim
1195
0644
edit
dl
rm
rst.vim
1820
0644
edit
dl
rm
ruby.vim
30148
0644
edit
dl
rm
rust.vim
6498
0644
edit
dl
rm
sas.vim
5270
0644
edit
dl
rm
sass.vim
950
0644
edit
dl
rm
scala.vim
19656
0644
edit
dl
rm
scheme.vim
372
0644
edit
dl
rm
scss.vim
191
0644
edit
dl
rm
sdl.vim
2829
0644
edit
dl
rm
sh.vim
9257
0644
edit
dl
rm
sml.vim
6478
0644
edit
dl
rm
sql.vim
1204
0644
edit
dl
rm
sqlanywhere.vim
13269
0644
edit
dl
rm
sshconfig.vim
796
0644
edit
dl
rm
systemd.vim
205
0644
edit
dl
rm
systemverilog.vim
8629
0644
edit
dl
rm
tcl.vim
2542
0644
edit
dl
rm
tcsh.vim
1381
0644
edit
dl
rm
teraterm.vim
1413
0644
edit
dl
rm
tex.vim
13689
0644
edit
dl
rm
tf.vim
1549
0644
edit
dl
rm
tilde.vim
1013
0644
edit
dl
rm
treetop.vim
708
0644
edit
dl
rm
typescript.vim
14481
0644
edit
dl
rm
vb.vim
2089
0644
edit
dl
rm
verilog.vim
8168
0644
edit
dl
rm
vhdl.vim
14666
0644
edit
dl
rm
vim.vim
5764
0644
edit
dl
rm
vroom.vim
379
0644
edit
dl
rm
wast.vim
458
0644
edit
dl
rm
xf86conf.vim
709
0644
edit
dl
rm
xhtml.vim
269
0644
edit
dl
rm
xinetd.vim
1231
0644
edit
dl
rm
xml.vim
7784
0644
edit
dl
rm
xsd.vim
253
0644
edit
dl
rm
xslt.vim
297
0644
edit
dl
rm
yacc.vim
781
0644
edit
dl
rm
yaml.vim
5471
0644
edit
dl
rm
zimbu.vim
3947
0644
edit
dl
rm
zsh.vim
411
0644
edit
dl
rm
Edit:
/usr/share/vim/vim82/indent/xml.vim
(7784B)
" Language: XML " Maintainer: Christian Brabandt <cb@256bit.org> " Repository: https://github.com/chrisbra/vim-xml-ftplugin " Previous Maintainer: Johannes Zellner <johannes@zellner.org> " Last Changed: 2020 Nov 4th " Last Change: " 20200529 - Handle empty closing tags correctly " 20191202 - Handle docbk filetype " 20190726 - Correctly handle non-tagged data " 20190204 - correctly handle wrap tags " https://github.com/chrisbra/vim-xml-ftplugin/issues/5 " 20190128 - Make sure to find previous tag " https://github.com/chrisbra/vim-xml-ftplugin/issues/4 " 20181116 - Fix indentation when tags start with a colon or an underscore " https://github.com/vim/vim/pull/926 " 20181022 - Do not overwrite indentkeys setting " https://github.com/chrisbra/vim-xml-ftplugin/issues/1 " 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 " " Notes: " 1) does not indent pure non-xml code (e.g. embedded scripts) " 2) will be confused by unbalanced tags in comments " or CDATA sections. " 2009-05-26 patch by Nikolai Weibull " TODO: implement pre-like tags, see xml_indent_open / xml_indent_close " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 let s:keepcpo= &cpo set cpo&vim " [-- local settings (must come before aborting the script) --] " Attention: Parameter use_syntax_check is used by the docbk.vim indent script setlocal indentexpr=XmlIndentGet(v:lnum,1) setlocal indentkeys=o,O,*<Return>,<>>,<<>,/,{,},!^F " autoindent: used when the indentexpr returns -1 setlocal autoindent let b:undo_indent = "setl ai< inde< indk<" if !exists('b:xml_indent_open') let b:xml_indent_open = '.\{-}<[:A-Z_a-z]' " pre tag, e.g. <address> " let b:xml_indent_open = '.\{-}<[/]\@!\(address\)\@!' endif if !exists('b:xml_indent_close') let b:xml_indent_close = '.\{-}</\|/>.\{-}' " end pre tag, e.g. </address> " let b:xml_indent_close = '.\{-}</\(address\)\@!' endif if !exists('b:xml_indent_continuation_filetype') let b:xml_indent_continuation_filetype = 'xml' endif let &cpo = s:keepcpo unlet s:keepcpo " [-- finish, if the function already exists --] if exists('*XmlIndentGet') finish endif let s:keepcpo= &cpo set cpo&vim fun! <SID>XmlIndentWithPattern(line, pat) let s = substitute('x'.a:line, a:pat, "\1", 'g') return strlen(substitute(s, "[^\1].*$", '', '')) endfun " [-- check if it's xml --] fun! <SID>XmlIndentSynCheck(lnum) if &syntax != '' let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name') let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') if syn1 != '' && syn1 !~ 'xml' && syn2 != '' && syn2 !~ 'xml' " don't indent pure non-xml code return 0 endif endif return 1 endfun " [-- return the sum of indents of a:lnum --] fun! <SID>XmlIndentSum(line, style, add) if <SID>IsXMLContinuation(a:line) && a:style == 0 && !<SID>IsXMLEmptyClosingTag(a:line) " no complete tag, add one additional indent level " but only for the current line return a:add + shiftwidth() elseif <SID>HasNoTagEnd(a:line) " no complete tag, return initial indent return a:add endif if a:style == match(a:line, '^\s*</') return (shiftwidth() * \ (<SID>XmlIndentWithPattern(a:line, b:xml_indent_open) \ - <SID>XmlIndentWithPattern(a:line, b:xml_indent_close) \ - <SID>XmlIndentWithPattern(a:line, '.\{-}/>'))) + a:add else return a:add endif endfun " Main indent function fun! XmlIndentGet(lnum, use_syntax_check) " Find a non-empty line above the current line. if prevnonblank(a:lnum - 1) == 0 " Hit the start of the file, use zero indent. return 0 endif " Find previous line with a tag (regardless whether open or closed, " but always restrict the match to a line before the current one " Note: xml declaration: <?xml version="1.0"?> " won't be found, as it is not a legal tag name let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. a:lnum .'l\)' let ptag = search(ptag_pattern, 'bnW') " no previous tag if ptag == 0 return 0 endif let pline = getline(ptag) let pind = indent(ptag) let syn_name_start = '' " Syntax element at start of line (excluding whitespace) let syn_name_end = '' " Syntax element at end of line let curline = getline(a:lnum) if a:use_syntax_check let check_lnum = <SID>XmlIndentSynCheck(ptag) let check_alnum = <SID>XmlIndentSynCheck(a:lnum) if check_lnum == 0 || check_alnum == 0 return indent(a:lnum) endif let syn_name_end = synIDattr(synID(a:lnum, strlen(curline) - 1, 1), 'name') let syn_name_start = synIDattr(synID(a:lnum, match(curline, '\S') + 1, 1), 'name') let prev_syn_name_end = synIDattr(synID(ptag, strlen(pline) - 1, 1), 'name') " not needed (yet?) " let prev_syn_name_start = synIDattr(synID(ptag, match(pline, '\S') + 1, 1), 'name') endif if syn_name_end =~ 'Comment' && syn_name_start =~ 'Comment' return <SID>XmlIndentComment(a:lnum) elseif empty(syn_name_start) && empty(syn_name_end) && a:use_syntax_check " non-xml tag content: use indent from 'autoindent' if pline =~ b:xml_indent_close return pind elseif !empty(prev_syn_name_end) " only indent by an extra shiftwidth, if the previous line ends " with an XML like tag return pind + shiftwidth() else " no extra indent, looks like a text continuation line return pind endif endif " Get indent from previous tag line let ind = <SID>XmlIndentSum(pline, -1, pind) " Determine indent from current line let ind = <SID>XmlIndentSum(curline, 0, ind) return ind endfun func! <SID>IsXMLContinuation(line) " Checks, whether or not the line matches a start-of-tag return a:line !~ '^\s*<' && &ft =~# b:xml_indent_continuation_filetype endfunc func! <SID>HasNoTagEnd(line) " Checks whether or not the line matches '>' (so finishes a tag) return a:line !~ '>\s*$' endfunc func! <SID>IsXMLEmptyClosingTag(line) " Checks whether the line ends with an empty closing tag such as <lb/> return a:line =~? '<[^>]*/>\s*$' endfunc " return indent for a commented line, " the middle part might be indented one additional level func! <SID>XmlIndentComment(lnum) let ptagopen = search('.\{-}<[:A-Z_a-z]\_[^/]\{-}>.\{-}', 'bnW') let ptagclose = search(b:xml_indent_close, 'bnW') if getline(a:lnum) =~ '<!--' " if previous tag was a closing tag, do not add " one additional level of indent if ptagclose > ptagopen && a:lnum > ptagclose " If the previous tag was closed on the same line as it was " declared, we should indent with its indent level. if !<SID>IsXMLContinuation(getline(ptagclose)) return indent(ptagclose) else return indent(ptagclose) - shiftwidth() endif elseif ptagclose == ptagopen return indent(ptagclose) else " start of comment, add one indentation level return indent(ptagopen) + shiftwidth() endif elseif getline(a:lnum) =~ '-->' " end of comment, same as start of comment return indent(search('<!--', 'bnW')) else " middle part of comment, add one additional level return indent(search('<!--', 'bnW')) + shiftwidth() endif endfunc let &cpo = s:keepcpo unlet s:keepcpo " vim:ts=4 et sts=-1 sw=0
Save
cmd:
run