annotate runtime/indent/idlang.vim @ 7216:310925215e17 v7.4.917

commit https://github.com/vim/vim/commit/1be2ed6c11671eabefa0fc8600fd2af6cd3963e8 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 10 19:11:58 2015 +0100 patch 7.4.917 Problem: Compiler warning for comparing signed and unsigned. Solution: Add a type cast.
author Christian Brabandt <cb@256bit.org>
date Tue, 10 Nov 2015 19:15:05 +0100
parents dd6c2497c997
children 63b0b7b79b25
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " IDL (Interactive Data Language) indent file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: IDL (ft=idlang)
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
3 " Last change: 2012 May 18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
12 setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,0=ENDWHILE,0=endfor,0=ENDFOR,0=endrep,0=ENDREP
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 setlocal indentexpr=GetIdlangIndent(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 if exists("*GetIdlangIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 function GetIdlangIndent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " First non-empty line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 let pnum = prevnonblank(v:lnum-1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " v:lnum is the first non-empty line -- zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 if pnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " Second non-empty line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 let pnum2 = prevnonblank(pnum-1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " Current indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 let curind = indent(pnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " Indenting of continued lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 if getline(pnum) =~ '\$\s*\(;.*\)\=$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let curind = curind+&sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 let curind = curind-&sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 " Indenting blocks of statements.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 if getline(pnum) =~? 'begin\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 elseif indent(v:lnum) > curind-&sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 let curind = curind-&sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 return -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 elseif getline(pnum) =~? 'begin\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 if indent(v:lnum) < curind+&sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 let curind = curind+&sw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 return -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 return curind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62