Mercurial > vim
annotate runtime/indent/idlang.vim @ 25880:9c221ad9634a
Update runtime files
Commit: https://github.com/vim/vim/commit/6e649224926bbc1df6a4fdfa7a96b4acb1f8bee0
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 4 21:32:54 2021 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 04 Oct 2021 22:45:05 +0200 |
parents | 63b0b7b79b25 |
children | 6dd88e45d47d |
rev | line source |
---|---|
7 | 1 " IDL (Interactive Data Language) indent file. |
25880 | 2 " Language: IDL (ft=idlang) |
3 " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> (Invalid email address) | |
4 " Doug Kearns <dougkearns@gmail.com> | |
11518 | 5 " Last change: 2017 Jun 13 |
7 | 6 |
7 " Only load this indent file when no other was loaded. | |
8 if exists("b:did_indent") | |
9 finish | |
10 endif | |
11 let b:did_indent = 1 | |
12 | |
3526
dd6c2497c997
Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents:
7
diff
changeset
|
13 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 | 14 |
15 setlocal indentexpr=GetIdlangIndent(v:lnum) | |
16 | |
17 " Only define the function once. | |
18 if exists("*GetIdlangIndent") | |
19 finish | |
20 endif | |
21 | |
22 function GetIdlangIndent(lnum) | |
23 " First non-empty line above the current line. | |
24 let pnum = prevnonblank(v:lnum-1) | |
25 " v:lnum is the first non-empty line -- zero indent. | |
26 if pnum == 0 | |
27 return 0 | |
28 endif | |
29 " Second non-empty line above the current line. | |
30 let pnum2 = prevnonblank(pnum-1) | |
31 | |
32 " Current indent. | |
33 let curind = indent(pnum) | |
34 | |
35 " Indenting of continued lines. | |
36 if getline(pnum) =~ '\$\s*\(;.*\)\=$' | |
37 if getline(pnum2) !~ '\$\s*\(;.*\)\=$' | |
11518 | 38 let curind = curind+shiftwidth() |
7 | 39 endif |
40 else | |
41 if getline(pnum2) =~ '\$\s*\(;.*\)\=$' | |
11518 | 42 let curind = curind-shiftwidth() |
7 | 43 endif |
44 endif | |
45 | |
46 " Indenting blocks of statements. | |
47 if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>' | |
48 if getline(pnum) =~? 'begin\>' | |
11518 | 49 elseif indent(v:lnum) > curind-shiftwidth() |
50 let curind = curind-shiftwidth() | |
7 | 51 else |
52 return -1 | |
53 endif | |
54 elseif getline(pnum) =~? 'begin\>' | |
11518 | 55 if indent(v:lnum) < curind+shiftwidth() |
56 let curind = curind+shiftwidth() | |
7 | 57 else |
58 return -1 | |
59 endif | |
60 endif | |
61 return curind | |
62 endfunction | |
63 |