annotate runtime/indent/eiffel.vim @ 33293:42b89193ab3e v9.0.1912

patch 9.0.1912: Cirrus-CI running out of credits Commit: https://github.com/vim/vim/commit/6f00d17e8d64ed46c85625e8ac38ed0928b32c58 Author: Christian Brabandt <cb@256bit.org> Date: Tue Sep 19 20:16:46 2023 +0200 patch 9.0.1912: Cirrus-CI running out of credits Problem: Cirrus-CI running out of credits Solution: disable Cirrus-CI for now We are running out of credits for Cirrus CI already at the middle of the month and unfortunately this means our CI now consistently fails. This all hapens because cirrus ci is not enforcing the free-tier limits (see also https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/). Perhaps at the beginning of the next month we can revisit and enable just a build without testing it. Hopefully this is won't take too many credits and we can at least verify that building works. Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Sep 2023 20:30:10 +0200
parents d0a20101ecb2
children
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 " Vim indent file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Eiffel
3557
9cb3a75a20b9 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
3 " Maintainer: Jocelyn Fiat <jfiat@eiffel.com>
26
404aac550f35 updated for version 7.0017
vimboss
parents: 7
diff changeset
4 " Previous-Maintainer: David Clarke <gadicath@dishevelled.net>
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
5 " Contributions from: Takuya Fujiwara
3557
9cb3a75a20b9 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
6 " Contributions from: Thilo Six
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
7 " $Date: 2017/03/08 06:00:00 $
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
8 " $Revision: 1.4 $
3557
9cb3a75a20b9 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
9 " URL: https://github.com/eiffelhub/vim-eiffel
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 setlocal indentexpr=GetEiffelIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 setlocal nolisp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 setlocal nosmartindent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 setlocal nocindent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 setlocal autoindent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 setlocal comments=:--
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 setlocal indentkeys+==end,=else,=ensure,=require,=check,=loop,=until
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 setlocal indentkeys+==creation,=feature,=inherit,=class,=is,=redefine,=rename,=variant
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 setlocal indentkeys+==invariant,=do,=local,=export
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3557
9cb3a75a20b9 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
27 let b:undo_indent = "setl smartindent< indentkeys< indentexpr< autoindent< comments< "
9cb3a75a20b9 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
28
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " Define some stuff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " keywords grouped by indenting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 let s:trust_user_indent = '\(+\)\(\s*\(--\).*\)\=$'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
32 let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|across\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 let s:outdent = '^\s*\(else\|invariant\|variant\|do\|require\|until\|loop\|local\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 let s:no_indent = '^\s*\(class\|feature\|creation\|inherit\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 let s:single_dent = '^[^-]\+[[:alnum:]]\+ is\(\s*\(--\).*\)\=$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 let s:inheritance_dent = '\s*\(redefine\|rename\|export\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if exists("*GetEiffelIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3557
9cb3a75a20b9 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3526
diff changeset
43
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
44 let s:keepcpo= &cpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
45 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 function GetEiffelIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 " Eiffel Class indenting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " Find a non-blank line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 let lnum = prevnonblank(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 " At the start of the file use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 " trust the user's indenting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 if getline(lnum) =~ s:trust_user_indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 return -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " Add a 'shiftwidth' after lines that start with an indent word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 let ind = indent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 if getline(lnum) =~ s:relative_indent
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
67 let ind = ind + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 " Indent to single indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 \ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
73 let ind = shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " Indent to double indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 if getline(v:lnum) =~ s:inheritance_dent
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
78 let ind = 2 * shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " Indent line after the first line of the function definition
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 if getline(lnum) =~ s:single_dent
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
83 let ind = ind + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 " The following should always be at the start of a line, no indenting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 if getline(v:lnum) =~ s:no_indent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 " Subtract a 'shiftwidth', if this isn't the first thing after the 'is'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 " or first thing after the 'do'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 \ && getline(v:lnum - 1) !~ '^\s*do\>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
95 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 " Subtract a shiftwidth for end statements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 if getline(v:lnum) =~ '^\s*end\>'
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
100 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 " set indent of zero end statements that are at an indent of 3, this should
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 " only ever be the class's end.
11160
d0a20101ecb2 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3557
diff changeset
105 if getline(v:lnum) =~ '^\s*end\>' && ind == shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3526
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
112 let &cpo = s:keepcpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
113 unlet s:keepcpo
dd6c2497c997 Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
114
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " vim:sw=2