/
usr
/
share
/
vim
/
vim74
/
indent
/
/usr/share/vim/vim74/indent
mkdir
upload
Name
Size
Mode
Actions
aap.vim
265
0644
edit
dl
rm
ada.vim
11147
0644
edit
dl
rm
ant.vim
290
0644
edit
dl
rm
automake.vim
231
0644
edit
dl
rm
awk.vim
7748
0644
edit
dl
rm
bib.vim
346
0644
edit
dl
rm
bst.vim
1919
0644
edit
dl
rm
c.vim
325
0644
edit
dl
rm
cdl.vim
4172
0644
edit
dl
rm
ch.vim
470
0644
edit
dl
rm
chaiscript.vim
1135
0644
edit
dl
rm
changelog.vim
264
0644
edit
dl
rm
clojure.vim
12132
0644
edit
dl
rm
cmake.vim
2754
0644
edit
dl
rm
cobol.vim
8197
0644
edit
dl
rm
config.vim
2166
0644
edit
dl
rm
cpp.vim
329
0644
edit
dl
rm
cs.vim
327
0644
edit
dl
rm
css.vim
1719
0644
edit
dl
rm
cucumber.vim
2624
0644
edit
dl
rm
cuda.vim
305
0644
edit
dl
rm
d.vim
510
0644
edit
dl
rm
dictconf.vim
325
0644
edit
dl
rm
dictdconf.vim
326
0644
edit
dl
rm
docbk.vim
324
0644
edit
dl
rm
dtd.vim
11668
0644
edit
dl
rm
dtrace.vim
451
0644
edit
dl
rm
dylan.vim
2662
0644
edit
dl
rm
eiffel.vim
3208
0644
edit
dl
rm
erlang.vim
46235
0644
edit
dl
rm
eruby.vim
2161
0644
edit
dl
rm
eterm.vim
638
0644
edit
dl
rm
falcon.vim
13982
0644
edit
dl
rm
fortran.vim
6559
0644
edit
dl
rm
framescript.vim
786
0644
edit
dl
rm
gitconfig.vim
817
0644
edit
dl
rm
gitolite.vim
996
0644
edit
dl
rm
haml.vim
2189
0644
edit
dl
rm
hamster.vim
1407
0644
edit
dl
rm
html.vim
14812
0644
edit
dl
rm
htmldjango.vim
273
0644
edit
dl
rm
idlang.vim
1566
0644
edit
dl
rm
ishd.vim
1841
0644
edit
dl
rm
java.vim
4115
0644
edit
dl
rm
javascript.vim
336
0644
edit
dl
rm
jsp.vim
462
0644
edit
dl
rm
ld.vim
1753
0644
edit
dl
rm
lifelines.vim
637
0644
edit
dl
rm
liquid.vim
1879
0644
edit
dl
rm
lisp.vim
353
0644
edit
dl
rm
logtalk.vim
1690
0644
edit
dl
rm
lua.vim
1914
0644
edit
dl
rm
mail.vim
308
0644
edit
dl
rm
make.vim
3431
0644
edit
dl
rm
matlab.vim
1928
0644
edit
dl
rm
mma.vim
2227
0644
edit
dl
rm
mp.vim
6527
0644
edit
dl
rm
objc.vim
1645
0644
edit
dl
rm
ocaml.vim
9110
0644
edit
dl
rm
occam.vim
4634
0644
edit
dl
rm
pascal.vim
5653
0644
edit
dl
rm
perl.vim
5811
0644
edit
dl
rm
perl6.vim
3503
0644
edit
dl
rm
php.vim
19423
0644
edit
dl
rm
postscr.vim
1622
0644
edit
dl
rm
pov.vim
2643
0644
edit
dl
rm
prolog.vim
1454
0644
edit
dl
rm
pyrex.vim
326
0644
edit
dl
rm
python.vim
5744
0644
edit
dl
rm
r.vim
14786
0644
edit
dl
rm
readline.vim
681
0644
edit
dl
rm
README.txt
1639
0644
edit
dl
rm
rpl.vim
1835
0644
edit
dl
rm
rst.vim
1387
0644
edit
dl
rm
ruby.vim
17546
0644
edit
dl
rm
sass.vim
1018
0644
edit
dl
rm
scheme.vim
241
0644
edit
dl
rm
scss.vim
191
0644
edit
dl
rm
sdl.vim
2767
0644
edit
dl
rm
sh.vim
4040
0644
edit
dl
rm
sml.vim
6418
0644
edit
dl
rm
sql.vim
1204
0644
edit
dl
rm
sqlanywhere.vim
13075
0644
edit
dl
rm
tcl.vim
1602
0644
edit
dl
rm
tcsh.vim
1243
0644
edit
dl
rm
tex.vim
9695
0644
edit
dl
rm
tf.vim
1499
0644
edit
dl
rm
tilde.vim
994
0644
edit
dl
rm
treetop.vim
677
0644
edit
dl
rm
vb.vim
2044
0644
edit
dl
rm
verilog.vim
7620
0644
edit
dl
rm
vhdl.vim
13801
0644
edit
dl
rm
vim.vim
2830
0644
edit
dl
rm
xf86conf.vim
679
0644
edit
dl
rm
xhtml.vim
269
0644
edit
dl
rm
xinetd.vim
1201
0644
edit
dl
rm
xml.vim
2840
0644
edit
dl
rm
xsd.vim
253
0644
edit
dl
rm
xslt.vim
297
0644
edit
dl
rm
yacc.vim
769
0644
edit
dl
rm
yaml.vim
4117
0644
edit
dl
rm
zimbu.vim
3891
0644
edit
dl
rm
zsh.vim
231
0644
edit
dl
rm
Edit:
/usr/share/vim/vim74/indent/cobol.vim
(8197B)
" Vim indent file " Language: cobol " Author: Tim Pope <vimNOSPAM@tpope.info> " $Id: cobol.vim,v 1.1 2007/05/05 18:08:19 vimboss Exp $ if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal expandtab setlocal indentexpr=GetCobolIndent(v:lnum) setlocal indentkeys& setlocal indentkeys+=0<*>,0/,0$,0=01,=~division,=~section,0=~end,0=~then,0=~else,0=~when,*<Return>,. " Only define the function once. if exists("*GetCobolIndent") finish endif let s:skip = 'getline(".") =~ "^.\\{6\\}[*/$-]\\|\"[^\"]*\""' function! s:prevgood(lnum) " Find a non-blank line above the current line. " Skip over comments. let lnum = a:lnum while lnum > 0 let lnum = prevnonblank(lnum - 1) let line = getline(lnum) if line !~? '^\s*[*/$-]' && line !~? '^.\{6\}[*/$CD-]' break endif endwhile return lnum endfunction function! s:stripped(lnum) return substitute(strpart(getline(a:lnum),0,72),'^\s*','','') endfunction function! s:optionalblock(lnum,ind,blocks,clauses) let ind = a:ind let clauses = '\c\<\%(\<NOT\s\+\)\@<!\%(NOT\s\+\)\=\%('.a:clauses.'\)' let begin = '\c-\@<!\<\%('.a:blocks.'\)\>' let beginfull = begin.'\ze.*\%(\n\%(\s*\%([*/$-].*\)\=\n\)*\)\=\s*\%('.clauses.'\)' let end = '\c\<end-\%('.a:blocks.'\)\>\|\%(\.\%( \|$\)\)\@=' let cline = s:stripped(a:lnum) let line = s:stripped(s:prevgood(a:lnum)) if cline =~? clauses "&& line !~? '^search\>' call cursor(a:lnum,1) let lastclause = searchpair(beginfull,clauses,end,'bWr',s:skip) if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin let ind = indent(lastclause) elseif lastclause > 0 let ind = indent(lastclause) + &sw "let ind = ind + &sw endif elseif line =~? clauses && cline !~? end let ind = ind + &sw endif return ind endfunction function! GetCobolIndent(lnum) abort let minshft = 6 let ashft = minshft + 1 let bshft = ashft + 4 " (Obsolete) numbered lines if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)' return 0 endif let cline = s:stripped(a:lnum) " Comments, etc. must start in the 7th column if cline =~? '^[*/$-]' return minshft elseif cline =~# '^[CD]' && indent(a:lnum) == minshft return minshft endif " Divisions, sections, and file descriptions start in area A if cline =~? '\<\(DIVISION\|SECTION\)\%($\|\.\)' || cline =~? '^[FS]D\>' return ashft endif " Fields if cline =~? '^0*\(1\|77\)\>' return ashft endif if cline =~? '^\d\+\>' let cnum = matchstr(cline,'^\d\+\>') let default = 0 let step = -1 while step < 2 let lnum = a:lnum while lnum > 0 && lnum < line('$') && lnum > a:lnum - 500 && lnum < a:lnum + 500 let lnum = step > 0 ? nextnonblank(lnum + step) : prevnonblank(lnum + step) let line = getline(lnum) let lindent = indent(lnum) if line =~? '^\s*\d\+\>' let num = matchstr(line,'^\s*\zs\d\+\>') if 0+cnum == num return lindent elseif 0+cnum > num && default < lindent + &sw let default = lindent + &sw endif elseif lindent < bshft && lindent >= ashft break endif endwhile let step = step + 2 endwhile return default ? default : bshft endif let lnum = s:prevgood(a:lnum) " Hit the start of the file, use "zero" indent. if lnum == 0 return ashft endif " Initial spaces are ignored let line = s:stripped(lnum) let ind = indent(lnum) " Paragraphs. There may be some false positives. if cline =~? '^\(\a[A-Z0-9-]*[A-Z0-9]\|\d[A-Z0-9-]*\a\)\.' "\s*$' if cline !~? '^EXIT\s*\.' && line =~? '\.\s*$' return ashft endif endif " Paragraphs in the identification division. "if cline =~? '^\(PROGRAM-ID\|AUTHOR\|INSTALLATION\|' . "\ 'DATE-WRITTEN\|DATE-COMPILED\|SECURITY\)\>' "return ashft "endif if line =~? '\.$' " XXX return bshft endif if line =~? '^PERFORM\>' let perfline = substitute(line, '\c^PERFORM\s*', "", "") if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$' let ind = ind + &sw elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$' let ind = ind + &sw endif endif if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>' let ind = ind + &sw endif let ind = s:optionalblock(a:lnum,ind,'ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT','ON\s\+SIZE\s\+ERROR') let ind = s:optionalblock(a:lnum,ind,'STRING\|UNSTRING\|ACCEPT\|DISPLAY\|CALL','ON\s\+OVERFLOW\|ON\s\+EXCEPTION') if cline !~? '^AT\s\+END\>' || line !~? '^SEARCH\>' let ind = s:optionalblock(a:lnum,ind,'DELETE\|REWRITE\|START\|WRITE\|READ','INVALID\s\+KEY\|AT\s\+END\|NO\s\+DATA\|AT\s\+END-OF-PAGE') endif if cline =~? '^WHEN\>' call cursor(a:lnum,1) " We also search for READ so that contained AT ENDs are skipped let lastclause = searchpair('\c-\@<!\<\%(SEARCH\|EVALUATE\|READ\)\>','\c\<\%(WHEN\|AT\s\+END\)\>','\c\<END-\%(SEARCH\|EVALUATE\|READ\)\>','bW',s:skip) let g:foo = s:stripped(lastclause) if s:stripped(lastclause) =~? '\c\<\%(WHEN\|AT\s\+END\)\>' "&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>' let ind = indent(lastclause) elseif lastclause > 0 let ind = indent(lastclause) + &sw endif elseif line =~? '^WHEN\>' let ind = ind + &sw endif "I'm not sure why I had this "if line =~? '^ELSE\>-\@!' && line !~? '\.$' "let ind = indent(s:prevgood(lnum)) "endif if cline =~? '^\(END\)\>-\@!' " On lines with just END, 'guess' a simple shift left let ind = ind - &sw elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!' call cursor(a:lnum,indent(a:lnum)) let match = searchpair('\c-\@<!\<IF\>','\c-\@<!\%(THEN\|ELSE\)\>','\c-\@<!\<END-IF\>\zs','bnW',s:skip) if match > 0 let ind = indent(match) endif elseif cline =~? '^END-[A-Z]' let beginword = matchstr(cline,'\c\<END-\zs[A-Z0-9-]\+') let endword = 'END-'.beginword let first = 0 let suffix = '.*\%(\n\%(\%(\s*\|.\{6\}\)[*/].*\n\)*\)\=\s*' if beginword =~? '^\%(ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT\)$' let beginword = beginword . suffix . '\<\%(NOT\s\+\)\=ON\s\+SIZE\s\+ERROR' let g:beginword = beginword let first = 1 elseif beginword =~? '^\%(STRING\|UNSTRING\)$' let beginword = beginword . suffix . '\<\%(NOT\s\+\)\=ON\s\+OVERFLOW' let first = 1 elseif beginword =~? '^\%(ACCEPT\|DISPLAY\)$' let beginword = beginword . suffix . '\<\%(NOT\s\+\)\=ON\s\+EXCEPTION' let first = 1 elseif beginword ==? 'CALL' let beginword = beginword . suffix . '\<\%(NOT\s\+\)\=ON\s\+\%(EXCEPTION\|OVERFLOW\)' let first = 1 elseif beginword =~? '^\%(DELETE\|REWRITE\|START\|READ\|WRITE\)$' let first = 1 let beginword = beginword . suffix . '\<\%(NOT\s\+\)\=\(INVALID\s\+KEY' if beginword =~? '^READ' let first = 0 let beginword = beginword . '\|AT\s\+END\|NO\s\+DATA' elseif beginword =~? '^WRITE' let beginword = beginword . '\|AT\s\+END-OF-PAGE' endif let beginword = beginword . '\)' endif call cursor(a:lnum,indent(a:lnum)) let match = searchpair('\c-\@<!\<'.beginword.'\>','','\c\<'.endword.'\>\zs','bnW'.(first? 'r' : ''),s:skip) if match > 0 let ind = indent(match) elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>' let ind = ind - &sw endif endif return ind < bshft ? bshft : ind endfunction
Save
cmd:
run