annotate runtime/indent/idlang.vim @ 11252:d7c1d5f7cf2a v8.0.0512

patch 8.0.0512: check for available characters takes too long commit https://github.com/vim/vim/commit/1572e30607e9a3bee9750242bf37168f7d2b6e66 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 25 20:16:28 2017 +0100 patch 8.0.0512: check for available characters takes too long Problem: Check for available characters takes too long. Solution: Only check did_start_blocking if wtime is negative. (Daisuke Suzuki, closes #1591)
author Christian Brabandt <cb@256bit.org>
date Sat, 25 Mar 2017 20:30:04 +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