annotate runtime/indent/perl.vim @ 10025:068f397d0da4 v7.4.2285

commit https://github.com/vim/vim/commit/d90b6c02e2900576fb37d95b5e4f4a32b2d7383f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 28 18:10:45 2016 +0200 patch 7.4.2285 Problem: Generated files are outdated. Solution: Generate the files. Avoid errors when generating prototypes.
author Christian Brabandt <cb@256bit.org>
date Sun, 28 Aug 2016 18:15:05 +0200
parents 42bf9264e64e
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 " 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>
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
4 " Homepage: http://github.com/vim-perl/vim-perl
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
5 " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
5277
42bf9264e64e Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5239
diff changeset
6 " Last Change: 2013-07-24
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
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
51 " Don't reindent comments on first column
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
52 if cline =~ '^#.'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
53 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
54 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
56 " Get current syntax item at the line's first char
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
57 let csynid = ''
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
58 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
59 let csynid = synIDattr(synID(v:lnum,1,0),"name")
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 " Don't reindent POD and heredocs
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
63 if csynid == "perlPOD" || csynid == "perlHereDoc" || csynid =~ "^pod"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
64 return indent(v:lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
65 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
67 " Indent end-of-heredocs markers to column 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
68 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
69 " 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
70 " confusion with other types of strings
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
71 if csynid == "perlStringStartEnd" && cline =~ '^\I\i*$'
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
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
74 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
75 " 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
76 if cline =~ '^\s*EO'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
77 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
78 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
81 " Now get the indent of the previous perl line.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
83 " Find a non-blank line above the current line.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
84 let lnum = prevnonblank(v:lnum - 1)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
85 " Hit the start of the file, use zero indent.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
86 if lnum == 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
87 return 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 endif
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
89 let line = getline(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
90 let ind = indent(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
91 " Skip heredocs, POD, and comments on 1st column
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
92 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
93 let skippin = 2
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
94 while skippin
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
95 let synid = synIDattr(synID(lnum,1,0),"name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
96 if (synid == "perlStringStartEnd" && line =~ '^\I\i*$')
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
97 \ || (skippin != 2 && synid == "perlPOD")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
98 \ || (skippin != 2 && synid == "perlHereDoc")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
99 \ || synid == "perlComment"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
100 \ || synid =~ "^pod"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
101 let lnum = prevnonblank(lnum - 1)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
102 if lnum == 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
103 return 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
104 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
105 let line = getline(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
106 let ind = indent(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
107 let skippin = 1
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
108 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
109 let skippin = 0
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
110 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
111 endwhile
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
112 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
113 if line =~ "^EO"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
114 let lnum = search("<<[\"']\\=EO", "bW")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
115 let line = getline(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
116 let ind = indent(lnum)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
117 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
118 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
120 " Indent blocks enclosed by {}, (), or []
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
121 if b:indent_use_syntax
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
122 " Find a real opening brace
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
123 " 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
124 " 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
125 " 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
126 " bracket as the first character in the class.
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
127 let braceclass = '[][(){}]'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
128 let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]'))
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
129 while bracepos != -1
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
130 let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
131 " 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
132 " 'perlHereDoc' is here only to handle the case '&foo(<<EOF)'.
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
133 if synid == ""
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
134 \ || synid == "perlMatchStartEnd"
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
135 \ || synid == "perlHereDoc"
5277
42bf9264e64e Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5239
diff changeset
136 \ || synid == "perlBraces"
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
137 \ || synid =~ "^perlFiledescStatement"
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
138 \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
139 let brace = strpart(line, bracepos, 1)
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
140 if brace == '(' || brace == '{' || brace == '['
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
141 let ind = ind + &sw
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
142 else
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
143 let ind = ind - &sw
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
144 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
145 endif
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
146 let bracepos = match(line, braceclass, bracepos + 1)
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
147 endwhile
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
148 let bracepos = matchend(cline, '^\s*[])}]')
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
149 if bracepos != -1
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
150 let synid = synIDattr(synID(v:lnum, bracepos, 0), "name")
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
151 if synid == ""
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
152 \ || synid == "perlMatchStartEnd"
5277
42bf9264e64e Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5239
diff changeset
153 \ || synid == "perlBraces"
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
154 \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
155 let ind = ind - &sw
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
156 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
157 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
158 else
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
159 if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
160 let ind = ind + &sw
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
161 endif
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
162 if cline =~ '^\s*[])}]'
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
163 let ind = ind - &sw
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
164 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
167 " Indent lines that begin with 'or' or 'and'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
168 if cline =~ '^\s*\(or\|and\)\>'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
169 if line !~ '^\s*\(or\|and\)\>'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
170 let ind = ind + &sw
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
171 endif
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
172 elseif line =~ '^\s*\(or\|and\)\>'
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
173 let ind = ind - &sw
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
176 return ind
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 let &cpo = s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 unlet s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
183 " vim:ts=8:sts=4:sw=4:expandtab:ft=vim