/
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
11235
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
2484
0644
edit
dl
rm
c.vim
325
0644
edit
dl
rm
cdl.vim
4253
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
11668
0644
edit
dl
rm
cmake.vim
2683
0644
edit
dl
rm
cobol.vim
8695
0644
edit
dl
rm
config.vim
2182
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
1790
0644
edit
dl
rm
cucumber.vim
2678
0644
edit
dl
rm
cuda.vim
305
0644
edit
dl
rm
d.vim
510
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
1335
0644
edit
dl
rm
dtd.vim
11869
0644
edit
dl
rm
dtrace.vim
451
0644
edit
dl
rm
dune.vim
332
0644
edit
dl
rm
dylan.vim
2707
0644
edit
dl
rm
eiffel.vim
3317
0644
edit
dl
rm
elm.vim
3223
0644
edit
dl
rm
erlang.vim
50066
0644
edit
dl
rm
eruby.vim
3016
0644
edit
dl
rm
eterm.vim
668
0644
edit
dl
rm
falcon.vim
14077
0644
edit
dl
rm
fortran.vim
7664
0644
edit
dl
rm
framescript.vim
816
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
1425
0644
edit
dl
rm
hog.vim
1892
0644
edit
dl
rm
html.vim
33539
0644
edit
dl
rm
htmldjango.vim
273
0644
edit
dl
rm
idlang.vim
1620
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
4527
0644
edit
dl
rm
jsp.vim
462
0644
edit
dl
rm
ld.vim
1792
0644
edit
dl
rm
less.vim
243
0644
edit
dl
rm
lifelines.vim
637
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
308
0644
edit
dl
rm
make.vim
3488
0644
edit
dl
rm
matlab.vim
4842
0644
edit
dl
rm
meson.vim
5223
0644
edit
dl
rm
mf.vim
156
0644
edit
dl
rm
mma.vim
2235
0644
edit
dl
rm
mp.vim
11321
0644
edit
dl
rm
nsis.vim
3257
0644
edit
dl
rm
objc.vim
1645
0644
edit
dl
rm
ocaml.vim
9191
0644
edit
dl
rm
occam.vim
4637
0644
edit
dl
rm
pascal.vim
5656
0644
edit
dl
rm
perl.vim
5905
0644
edit
dl
rm
perl6.vim
3542
0644
edit
dl
rm
php.vim
25901
0644
edit
dl
rm
postscr.vim
1649
0644
edit
dl
rm
pov.vim
2662
0644
edit
dl
rm
prolog.vim
1804
0644
edit
dl
rm
pyrex.vim
326
0644
edit
dl
rm
python.vim
6928
0644
edit
dl
rm
r.vim
14037
0644
edit
dl
rm
raml.vim
285
0644
edit
dl
rm
readline.vim
711
0644
edit
dl
rm
README.txt
1689
0644
edit
dl
rm
rhelp.vim
2840
0644
edit
dl
rm
rmd.vim
1680
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
30119
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
19430
0644
edit
dl
rm
scheme.vim
372
0644
edit
dl
rm
scss.vim
191
0644
edit
dl
rm
sdl.vim
2794
0644
edit
dl
rm
sh.vim
9271
0644
edit
dl
rm
sml.vim
6478
0644
edit
dl
rm
sql.vim
1204
0644
edit
dl
rm
sqlanywhere.vim
13426
0644
edit
dl
rm
sshconfig.vim
796
0644
edit
dl
rm
systemd.vim
205
0644
edit
dl
rm
systemverilog.vim
8626
0644
edit
dl
rm
tcl.vim
2513
0644
edit
dl
rm
tcsh.vim
1270
0644
edit
dl
rm
teraterm.vim
1365
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
707
0644
edit
dl
rm
typescript.vim
14480
0644
edit
dl
rm
vb.vim
2089
0644
edit
dl
rm
verilog.vim
8165
0644
edit
dl
rm
vhdl.vim
14666
0644
edit
dl
rm
vim.vim
5702
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
7604
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
3936
0644
edit
dl
rm
zsh.vim
411
0644
edit
dl
rm
Edit:
/usr/share/vim/vim82/indent/ada.vim
(11235B)
"------------------------------------------------------------------------------ " Description: Vim Ada indent file " Language: Ada (2005) " $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischik <krischik@users.sourceforge.net> " Neil Bird <neil@fnxweb.com> " Ned Okie <nokie@radford.edu> " $Author: krischik $ " $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 " $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/indent/ada.vim $ " History: 24.05.2006 MK Unified Headers " 16.07.2006 MK Ada-Mode as vim-ball " 15.10.2006 MK Bram's suggestion for runtime integration " 05.11.2006 MK Bram suggested to save on spaces " 19.09.2007 NO g: missing before ada#Comment " Help Page: ft-vim-indent "------------------------------------------------------------------------------ " ToDo: " Verify handling of multi-line exprs. and recovery upon the final ';'. " Correctly find comments given '"' and "" ==> " syntax. " Combine the two large block-indent functions into one? "------------------------------------------------------------------------------ " Only load this indent file when no other was loaded. if exists("b:did_indent") || version < 700 finish endif let b:did_indent = 45 setlocal indentexpr=GetAdaIndent() setlocal indentkeys-=0{,0} setlocal indentkeys+=0=~then,0=~end,0=~elsif,0=~when,0=~exception,0=~begin,0=~is,0=~record " Only define the functions once. if exists("*GetAdaIndent") finish endif let s:keepcpo= &cpo set cpo&vim if exists("g:ada_with_gnat_project_files") let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\<is\>[^;]*$\|\(type\>.*\)\=\<record\>\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|project\>\|then\>\|when\>\|is\>\)' else let s:AdaBlockStart = '^\s*\(if\>\|while\>\|else\>\|elsif\>\|loop\>\|for\>.*\<\(loop\|use\)\>\|declare\>\|begin\>\|type\>.*\<is\>[^;]*$\|\(type\>.*\)\=\<record\>\|procedure\>\|function\>\|accept\>\|do\>\|task\>\|package\>\|then\>\|when\>\|is\>\)' endif " Section: s:MainBlockIndent {{{1 " " Try to find indent of the block we're in " prev_indent = the previous line's indent " prev_lnum = previous line (to start looking on) " blockstart = expr. that indicates a possible start of this block " stop_at = if non-null, if a matching line is found, gives up! " No recursive previous block analysis: simply look for a valid line " with a lesser or equal indent than we currently (on prev_lnum) have. " This shouldn't work as well as it appears to with lines that are currently " nowhere near the correct indent (e.g., start of line)! " Seems to work OK as it 'starts' with the indent of the /previous/ line. function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at) let lnum = a:prev_lnum let line = substitute( getline(lnum), g:ada#Comment, '', '' ) while lnum > 1 if a:stop_at != '' && line =~ '^\s*' . a:stop_at && indent(lnum) < a:prev_indent return a:prev_indent elseif line =~ '^\s*' . a:blockstart let ind = indent(lnum) if ind < a:prev_indent return ind endif endif let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) if line !~ '^\s*$' && line !~ '^\s*#' break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 return a:prev_indent endif endwhile endwhile " Fallback - just move back one return a:prev_indent - shiftwidth() endfunction MainBlockIndent " Section: s:EndBlockIndent {{{1 " " Try to find indent of the block we're in (and about to complete), " including handling of nested blocks. Works on the 'end' of a block. " prev_indent = the previous line's indent " prev_lnum = previous line (to start looking on) " blockstart = expr. that indicates a possible start of this block " blockend = expr. that indicates a possible end of this block function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend ) let lnum = a:prev_lnum let line = getline(lnum) let ends = 0 while lnum > 1 if getline(lnum) =~ '^\s*' . a:blockstart let ind = indent(lnum) if ends <= 0 if ind < a:prev_indent return ind endif else let ends = ends - 1 endif elseif getline(lnum) =~ '^\s*' . a:blockend let ends = ends + 1 endif let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 let line = getline(lnum) let line = substitute( line, g:ada#Comment, '', '' ) if line !~ '^\s*$' break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 return a:prev_indent endif endwhile endwhile " Fallback - just move back one return a:prev_indent - shiftwidth() endfunction EndBlockIndent " Section: s:StatementIndent {{{1 " " Return indent of previous statement-start " (after we've indented due to multi-line statements). " This time, we start searching on the line *before* the one given (which is " the end of a statement - we want the previous beginning). function s:StatementIndent( current_indent, prev_lnum ) let lnum = a:prev_lnum while lnum > 0 let prev_lnum = lnum let lnum = prevnonblank(lnum - 1) " Get previous non-blank/non-comment-only line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) if line !~ '^\s*$' && line !~ '^\s*#' break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 return a:current_indent endif endwhile " Leave indent alone if our ';' line is part of a ';'-delineated " aggregate (e.g., procedure args.) or first line after a block start. if line =~ s:AdaBlockStart || line =~ '(\s*$' return a:current_indent endif if line !~ '[.=(]\s*$' let ind = indent(prev_lnum) if ind < a:current_indent return ind endif endif endwhile " Fallback - just use current one return a:current_indent endfunction StatementIndent " Section: GetAdaIndent {{{1 " " Find correct indent of a new line based upon what went before " function GetAdaIndent() " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) let ind = indent(lnum) let package_line = 0 " Get previous non-blank/non-comment-only/non-cpp line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) if line !~ '^\s*$' && line !~ '^\s*#' break endif let lnum = prevnonblank(lnum - 1) if lnum <= 0 return ind endif endwhile " Get default indent (from prev. line) let ind = indent(lnum) let initind = ind " Now check what's on the previous line if line =~ s:AdaBlockStart || line =~ '(\s*$' " Check for false matches to AdaBlockStart let false_match = 0 if line =~ '^\s*\(procedure\|function\|package\)\>.*\<is\s*new\>' " Generic instantiation let false_match = 1 elseif line =~ ')\s*;\s*$' || line =~ '^\([^(]*([^)]*)\)*[^(]*;\s*$' " forward declaration let false_match = 1 endif " Move indent in if ! false_match let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(case\|exception\)\>' " Move indent in twice (next 'when' will move back) let ind = ind + 2 * shiftwidth() elseif line =~ '^\s*end\s*record\>' " Move indent back to tallying 'type' preceeding the 'record'. " Allow indent to be equal to 'end record's. let ind = s:MainBlockIndent( ind+shiftwidth(), lnum, 'type\>', '' ) elseif line =~ '\(^\s*new\>.*\)\@<!)\s*[;,]\s*$' " Revert to indent of line that started this parenthesis pair exe lnum exe 'normal! $F)%' if getline('.') =~ '^\s*(' " Dire layout - use previous indent (could check for g:ada#Comment here) let ind = indent( prevnonblank( line('.')-1 ) ) else let ind = indent('.') endif exe v:lnum elseif line =~ '[.=(]\s*$' " A statement continuation - move in one let ind = ind + shiftwidth() elseif line =~ '^\s*new\>' " Multiple line generic instantiation ('package blah is\nnew thingy') let ind = s:StatementIndent( ind - shiftwidth(), lnum ) elseif line =~ ';\s*$' " Statement end (but not 'end' ) - try to find current statement-start indent let ind = s:StatementIndent( ind, lnum ) endif " Check for potential argument list on next line let continuation = (line =~ '[A-Za-z0-9_]\s*$') " Check current line; search for simplistic matching start-of-block let line = getline(v:lnum) if line =~ '^\s*#' " Start of line for ada-pp let ind = 0 elseif continuation && line =~ '^\s*(' " Don't do this if we've already indented due to the previous line if ind == initind let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(begin\|is\)\>' let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' ) elseif line =~ '^\s*record\>' let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + shiftwidth() elseif line =~ '^\s*\(else\|elsif\)\>' let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' ) elseif line =~ '^\s*when\>' " Align 'when' one /in/ from matching block start let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + shiftwidth() elseif line =~ '^\s*end\>\s*\<if\>' " End of if statements let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' ) elseif line =~ '^\s*end\>\s*\<loop\>' " End of loops let ind = s:EndBlockIndent( ind, lnum, '\(\(while\|for\)\>.*\)\?\<loop\>', 'end\>\s*\<loop\>' ) elseif line =~ '^\s*end\>\s*\<record\>' " End of records let ind = s:EndBlockIndent( ind, lnum, '\(type\>.*\)\=\<record\>', 'end\>\s*\<record\>' ) elseif line =~ '^\s*end\>\s*\<procedure\>' " End of procedures let ind = s:EndBlockIndent( ind, lnum, 'procedure\>.*\<is\>', 'end\>\s*\<procedure\>' ) elseif line =~ '^\s*end\>\s*\<case\>' " End of case statement let ind = s:EndBlockIndent( ind, lnum, 'case\>.*\<is\>', 'end\>\s*\<case\>' ) elseif line =~ '^\s*end\>' " General case for end let ind = s:MainBlockIndent( ind, lnum, '\(if\|while\|for\|loop\|accept\|begin\|record\|case\|exception\|package\)\>', '' ) elseif line =~ '^\s*exception\>' let ind = s:MainBlockIndent( ind, lnum, 'begin\>', '' ) elseif line =~ '^\s*then\>' let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' ) endif return ind endfunction GetAdaIndent let &cpo = s:keepcpo unlet s:keepcpo finish " 1}}} "------------------------------------------------------------------------------ " Copyright (C) 2006 Martin Krischik " " Vim is Charityware - see ":help license" or uganda.txt for licence details. "------------------------------------------------------------------------------ " vim: textwidth=78 wrap tabstop=8 shiftwidth=3 softtabstop=3 noexpandtab " vim: foldmethod=marker
Save
cmd:
run