annotate runtime/indent/perl.vim @ 20528:489cb75c76b6 v8.2.0818

patch 8.2.0818: Vim9: using a discovery phase doesn't work well Commit: https://github.com/vim/vim/commit/822ba24743af9ee1b5e7f656a7a61a38f3638bca Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 24 23:00:18 2020 +0200 patch 8.2.0818: Vim9: using a discovery phase doesn't work well Problem: Vim9: using a discovery phase doesn't work well. Solution: Remove the discovery phase, instead compile a function only when it is used. Add :defcompile to compile def functions earlier.
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 May 2020 23:15:04 +0200
parents bd021eb62e73
children d1fe80fb35e6
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
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
2 " Language: Perl 5
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
3 " Maintainer: vim-perl <vim-perl@googlegroups.com>
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12499
diff changeset
4 " Homepage: https://github.com/vim-perl/vim-perl
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12499
diff changeset
5 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12499
diff changeset
6 " Last Change: 2020 Apr 15
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Suggestions and improvements by :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " Aaron J. Sherman (use syntax for hints)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " Artem Chuprina (play nice with folding)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " TODO things that are not or not properly indented (yet) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " - Continued statements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " print "foo",
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
15 " "bar";
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " print "foo"
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
17 " if bar();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " - Multiline regular expressions (m//x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " (The following probably needs modifying the perl syntax file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " - qw() lists
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " - Heredocs with terminators that don't match \I\i*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 if exists("b:did_indent")
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
25 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " Is syntax highlighting active ?
508
c8ec93ec75dc updated for version 7.0143
vimboss
parents: 416
diff changeset
30 let b:indent_use_syntax = has("syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 setlocal indentexpr=GetPerlIndent()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
33 setlocal indentkeys+=0=,0),0],0=or,0=and
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 if !b:indent_use_syntax
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
35 setlocal indentkeys+=0=EO
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
416
3da34f87c760 updated for version 7.0109
vimboss
parents: 7
diff changeset
38 let s:cpo_save = &cpo
3da34f87c760 updated for version 7.0109
vimboss
parents: 7
diff changeset
39 set cpo-=C
3da34f87c760 updated for version 7.0109
vimboss
parents: 7
diff changeset
40
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
41 function! GetPerlIndent()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
43 " Get the line to be indented
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
44 let cline = getline(v:lnum)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
46 " Indent POD markers to column 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
47 if cline =~ '^\s*=\L\@!'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
48 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
49 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
51 " Get current syntax item at the line's first char
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
52 let csynid = ''
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
53 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
54 let csynid = synIDattr(synID(v:lnum,1,0),"name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
55 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
57 " Don't reindent POD and heredocs
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
58 if csynid == "perlPOD" || csynid == "perlHereDoc" || csynid =~ "^pod"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
59 return indent(v:lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
60 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
62 " Indent end-of-heredocs markers to column 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
63 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
64 " Assumes that an end-of-heredoc marker matches \I\i* to avoid
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
65 " confusion with other types of strings
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
66 if csynid == "perlStringStartEnd" && cline =~ '^\I\i*$'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
67 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
68 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
69 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
70 " Without syntax hints, assume that end-of-heredocs markers begin with EO
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
71 if cline =~ '^\s*EO'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
72 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
73 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
76 " Now get the indent of the previous perl line.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
78 " Find a non-blank line above the current line.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
79 let lnum = prevnonblank(v:lnum - 1)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
80 " Hit the start of the file, use zero indent.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
81 if lnum == 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
82 return 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 endif
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
84 let line = getline(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
85 let ind = indent(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
86 " Skip heredocs, POD, and comments on 1st column
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
87 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
88 let skippin = 2
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
89 while skippin
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
90 let synid = synIDattr(synID(lnum,1,0),"name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
91 if (synid == "perlStringStartEnd" && line =~ '^\I\i*$')
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
92 \ || (skippin != 2 && synid == "perlPOD")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
93 \ || (skippin != 2 && synid == "perlHereDoc")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
94 \ || synid == "perlComment"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
95 \ || synid =~ "^pod"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
96 let lnum = prevnonblank(lnum - 1)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
97 if lnum == 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
98 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
99 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
100 let line = getline(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
101 let ind = indent(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
102 let skippin = 1
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
103 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
104 let skippin = 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
105 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
106 endwhile
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
107 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
108 if line =~ "^EO"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
109 let lnum = search("<<[\"']\\=EO", "bW")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
110 let line = getline(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
111 let ind = indent(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
112 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
113 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
115 " Indent blocks enclosed by {}, (), or []
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
116 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
117 " Find a real opening brace
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
118 " NOTE: Unlike Perl character classes, we do NOT need to escape the
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
119 " closing brackets with a backslash. Doing so just puts a backslash
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
120 " in the character class and causes sorrow. Instead, put the closing
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
121 " bracket as the first character in the class.
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
122 let braceclass = '[][(){}]'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
123 let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]'))
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
124 while bracepos != -1
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
125 let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
126 " If the brace is highlighted in one of those groups, indent it.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
127 " 'perlHereDoc' is here only to handle the case '&foo(<<EOF)'.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
128 if synid == ""
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
129 \ || synid == "perlMatchStartEnd"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
130 \ || synid == "perlHereDoc"
5277
42bf9264e64e Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5239
diff changeset
131 \ || synid == "perlBraces"
12499
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
132 \ || synid == "perlStatementIndirObj"
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
133 \ || synid =~ "^perlFiledescStatement"
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
134 \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
135 let brace = strpart(line, bracepos, 1)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
136 if brace == '(' || brace == '{' || brace == '['
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
137 let ind = ind + shiftwidth()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
138 else
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
139 let ind = ind - shiftwidth()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
140 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
141 endif
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
142 let bracepos = match(line, braceclass, bracepos + 1)
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
143 endwhile
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
144 let bracepos = matchend(cline, '^\s*[])}]')
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
145 if bracepos != -1
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
146 let synid = synIDattr(synID(v:lnum, bracepos, 0), "name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
147 if synid == ""
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
148 \ || synid == "perlMatchStartEnd"
5277
42bf9264e64e Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5239
diff changeset
149 \ || synid == "perlBraces"
12499
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
150 \ || synid == "perlStatementIndirObj"
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
151 \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
152 let ind = ind - shiftwidth()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
153 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
154 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
155 else
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
156 if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
157 let ind = ind + shiftwidth()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
158 endif
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
159 if cline =~ '^\s*[])}]'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
160 let ind = ind - shiftwidth()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
161 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
164 " Indent lines that begin with 'or' or 'and'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
165 if cline =~ '^\s*\(or\|and\)\>'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
166 if line !~ '^\s*\(or\|and\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
167 let ind = ind + shiftwidth()
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
168 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
169 elseif line =~ '^\s*\(or\|and\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 5277
diff changeset
170 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
173 return ind
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 let &cpo = s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 unlet s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
180 " vim:ts=8:sts=4:sw=4:expandtab:ft=vim