comparison runtime/indent/eiffel.vim @ 11160:d0a20101ecb2

Update runtime files. commit https://github.com/vim/vim/commit/036986f1507d223549d110af300144468bd3a1f7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 16 17:41:02 2017 +0100 Update runtime files.
author Christian Brabandt <cb@256bit.org>
date Thu, 16 Mar 2017 17:45:05 +0100
parents 9cb3a75a20b9
children
comparison
equal deleted inserted replaced
11159:c13ab9398ce9 11160:d0a20101ecb2
1 " Vim indent file 1 " Vim indent file
2 " Language: Eiffel 2 " Language: Eiffel
3 " Maintainer: Jocelyn Fiat <jfiat@eiffel.com> 3 " Maintainer: Jocelyn Fiat <jfiat@eiffel.com>
4 " Previous-Maintainer: David Clarke <gadicath@dishevelled.net> 4 " Previous-Maintainer: David Clarke <gadicath@dishevelled.net>
5 " Contributions from: Takuya Fujiwara
5 " Contributions from: Thilo Six 6 " Contributions from: Thilo Six
6 " $Date: 2004/12/09 21:33:52 $ 7 " $Date: 2017/03/08 06:00:00 $
7 " $Revision: 1.3 $ 8 " $Revision: 1.4 $
8 " URL: https://github.com/eiffelhub/vim-eiffel 9 " URL: https://github.com/eiffelhub/vim-eiffel
9 10
10 " Only load this indent file when no other was loaded. 11 " Only load this indent file when no other was loaded.
11 if exists("b:did_indent") 12 if exists("b:did_indent")
12 finish 13 finish
26 let b:undo_indent = "setl smartindent< indentkeys< indentexpr< autoindent< comments< " 27 let b:undo_indent = "setl smartindent< indentkeys< indentexpr< autoindent< comments< "
27 28
28 " Define some stuff 29 " Define some stuff
29 " keywords grouped by indenting 30 " keywords grouped by indenting
30 let s:trust_user_indent = '\(+\)\(\s*\(--\).*\)\=$' 31 let s:trust_user_indent = '\(+\)\(\s*\(--\).*\)\=$'
31 let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' 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\)\>'
32 let s:outdent = '^\s*\(else\|invariant\|variant\|do\|require\|until\|loop\|local\)\>' 33 let s:outdent = '^\s*\(else\|invariant\|variant\|do\|require\|until\|loop\|local\)\>'
33 let s:no_indent = '^\s*\(class\|feature\|creation\|inherit\)\>' 34 let s:no_indent = '^\s*\(class\|feature\|creation\|inherit\)\>'
34 let s:single_dent = '^[^-]\+[[:alnum:]]\+ is\(\s*\(--\).*\)\=$' 35 let s:single_dent = '^[^-]\+[[:alnum:]]\+ is\(\s*\(--\).*\)\=$'
35 let s:inheritance_dent = '\s*\(redefine\|rename\|export\)\>' 36 let s:inheritance_dent = '\s*\(redefine\|rename\|export\)\>'
36 37
61 endif 62 endif
62 63
63 " Add a 'shiftwidth' after lines that start with an indent word 64 " Add a 'shiftwidth' after lines that start with an indent word
64 let ind = indent(lnum) 65 let ind = indent(lnum)
65 if getline(lnum) =~ s:relative_indent 66 if getline(lnum) =~ s:relative_indent
66 let ind = ind + &sw 67 let ind = ind + shiftwidth()
67 endif 68 endif
68 69
69 " Indent to single indent 70 " Indent to single indent
70 if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent 71 if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent
71 \ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>' 72 \ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>'
72 let ind = &sw 73 let ind = shiftwidth()
73 endif 74 endif
74 75
75 " Indent to double indent 76 " Indent to double indent
76 if getline(v:lnum) =~ s:inheritance_dent 77 if getline(v:lnum) =~ s:inheritance_dent
77 let ind = 2 * &sw 78 let ind = 2 * shiftwidth()
78 endif 79 endif
79 80
80 " Indent line after the first line of the function definition 81 " Indent line after the first line of the function definition
81 if getline(lnum) =~ s:single_dent 82 if getline(lnum) =~ s:single_dent
82 let ind = ind + &sw 83 let ind = ind + shiftwidth()
83 endif 84 endif
84 85
85 " The following should always be at the start of a line, no indenting 86 " The following should always be at the start of a line, no indenting
86 if getline(v:lnum) =~ s:no_indent 87 if getline(v:lnum) =~ s:no_indent
87 let ind = 0 88 let ind = 0
89 90
90 " Subtract a 'shiftwidth', if this isn't the first thing after the 'is' 91 " Subtract a 'shiftwidth', if this isn't the first thing after the 'is'
91 " or first thing after the 'do' 92 " or first thing after the 'do'
92 if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent 93 if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent
93 \ && getline(v:lnum - 1) !~ '^\s*do\>' 94 \ && getline(v:lnum - 1) !~ '^\s*do\>'
94 let ind = ind - &sw 95 let ind = ind - shiftwidth()
95 endif 96 endif
96 97
97 " Subtract a shiftwidth for end statements 98 " Subtract a shiftwidth for end statements
98 if getline(v:lnum) =~ '^\s*end\>' 99 if getline(v:lnum) =~ '^\s*end\>'
99 let ind = ind - &sw 100 let ind = ind - shiftwidth()
100 endif 101 endif
101 102
102 " set indent of zero end statements that are at an indent of 3, this should 103 " set indent of zero end statements that are at an indent of 3, this should
103 " only ever be the class's end. 104 " only ever be the class's end.
104 if getline(v:lnum) =~ '^\s*end\>' && ind == &sw 105 if getline(v:lnum) =~ '^\s*end\>' && ind == shiftwidth()
105 let ind = 0 106 let ind = 0
106 endif 107 endif
107 108
108 return ind 109 return ind
109 endfunction 110 endfunction