annotate runtime/indent/ruby.vim @ 5745:2f225a17c26b v7.4.217

updated for version 7.4.217 Problem: When src/auto/configure was updated, "make clean" would run configure pointlessly. Solution: Do not run configure for "make clean" and "make distclean" when the make program supports $MAKECMDGOALS. (Ken Takata)
author Bram Moolenaar <bram@vim.org>
date Tue, 25 Mar 2014 15:34:48 +0100
parents a5352e73dc00
children 43efa4f5a8ea
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
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 557
diff changeset
2 " Language: Ruby
9f279ebda751 updated for version 7.0f01
vimboss
parents: 557
diff changeset
3 " Maintainer: Nikolai Weibull <now at bitwi.se>
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
4 " URL: https://github.com/vim-ruby/vim-ruby
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 557
diff changeset
5 " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
6
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
7 " 0. Initialization {{{1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
8 " =================
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 557
diff changeset
16 setlocal nosmartindent
9f279ebda751 updated for version 7.0f01
vimboss
parents: 557
diff changeset
17
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
18 " Now, set up our indentation expression and keys that trigger it.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
19 setlocal indentexpr=GetRubyIndent(v:lnum)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
20 setlocal indentkeys=0{,0},0),0],!^F,o,O,e
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
21 setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 if exists("*GetRubyIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
28 let s:cpo_save = &cpo
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
29 set cpo&vim
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
30
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
31 " 1. Variables {{{1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
32 " ============
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
33
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
34 " Regex of syntax group names that are or delimit strings/symbols or are comments.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
35 let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
36 \ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
37 \ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
38
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
39 " Regex of syntax group names that are strings.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
40 let s:syng_string =
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
41 \ '\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\)\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
42
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
43 " Regex of syntax group names that are strings or documentation.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
44 let s:syng_stringdoc =
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
45 \'\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
46
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
47 " Expression used to check whether we should skip a match with searchpair().
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
48 let s:skip_expr =
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
49 \ "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
50
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
51 " Regex used for words that, at the start of a line, add a level of indent.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
52 let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
53 \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' .
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
54 \ '\|rescue\):\@!\>' .
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
55 \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
56 \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
57
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
58 " Regex used for words that, at the start of a line, remove a level of indent.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
59 let s:ruby_deindent_keywords =
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
60 \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\):\@!\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
61
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
62 " Regex that defines the start-match for the 'end' keyword.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
63 "let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
64 " TODO: the do here should be restricted somewhat (only at end of line)?
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
65 let s:end_start_regex =
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
66 \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
67 \ '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
68 \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
69
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
70 " Regex that defines the middle-match for the 'end' keyword.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
71 let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\<rescue:\@!\>\|when\|elsif\):\@!\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
72
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
73 " Regex that defines the end-match for the 'end' keyword.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
74 let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\<end:\@!\>'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
75
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
76 " Expression used for searchpair() call for finding match for 'end' keyword.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
77 let s:end_skip_expr = s:skip_expr .
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
78 \ ' || (expand("<cword>") == "do"' .
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
79 \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
80
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
81 " Regex that defines continuation lines, not including (, {, or [.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
82 let s:non_bracket_continuation_regex = '\%([\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
83
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
84 " Regex that defines continuation lines.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
85 " TODO: this needs to deal with if ...: and so on
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
86 let s:continuation_regex =
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
87 \ '\%(%\@<![({[\\.,:*/%+]\|\<and\|\<or\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
88
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
89 " Regex that defines bracket continuations
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
90 let s:bracket_continuation_regex = '%\@<!\%([({[]\)\s*\%(#.*\)\=$'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
91
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
92 " Regex that defines the first part of a splat pattern
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
93 let s:splat_regex = '[[,(]\s*\*\s*\%(#.*\)\=$'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
94
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
95 " Regex that defines blocks.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
96 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
97 " Note that there's a slight problem with this regex and s:continuation_regex.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
98 " Code like this will be matched by both:
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
99 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
100 " method_call do |(a, b)|
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
101 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
102 " The reason is that the pipe matches a hanging "|" operator.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
103 "
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
104 let s:block_regex =
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
105 \ '\%(\<do:\@!\>\|%\@<!{\)\s*\%(|\s*(*\s*\%([*@&]\=\h\w*,\=\s*\)\%(,\s*(*\s*[*@&]\=\h\w*\s*)*\s*\)*|\)\=\s*\%(#.*\)\=$'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
106
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
107 let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
108
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
109 " 2. Auxiliary Functions {{{1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
110 " ======================
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
111
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
112 " Check if the character at lnum:col is inside a string, comment, or is ascii.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
113 function s:IsInStringOrComment(lnum, col)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
114 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
115 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
116
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
117 " Check if the character at lnum:col is inside a string.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
118 function s:IsInString(lnum, col)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
119 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
120 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
121
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
122 " Check if the character at lnum:col is inside a string or documentation.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
123 function s:IsInStringOrDocumentation(lnum, col)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
124 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
125 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
126
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
127 " Check if the character at lnum:col is inside a string delimiter
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
128 function s:IsInStringDelimiter(lnum, col)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
129 return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'rubyStringDelimiter'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
130 endfunction
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
131
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
132 " Find line above 'lnum' that isn't empty, in a comment, or in a string.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
133 function s:PrevNonBlankNonString(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
134 let in_block = 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
135 let lnum = prevnonblank(a:lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
136 while lnum > 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
137 " Go in and out of blocks comments as necessary.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
138 " If the line isn't empty (with opt. comment) or in a string, end search.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
139 let line = getline(lnum)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
140 if line =~ '^=begin'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
141 if in_block
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
142 let in_block = 0
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
143 else
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
144 break
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
145 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
146 elseif !in_block && line =~ '^=end'
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
147 let in_block = 1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
148 elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
149 \ && s:IsInStringOrComment(lnum, strlen(line)))
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
150 break
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
151 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
152 let lnum = prevnonblank(lnum - 1)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
153 endwhile
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
154 return lnum
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
155 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
156
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
157 " Find line above 'lnum' that started the continuation 'lnum' may be part of.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
158 function s:GetMSL(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
159 " Start on the line we're at and use its indent.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
160 let msl = a:lnum
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
161 let msl_body = getline(msl)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
162 let lnum = s:PrevNonBlankNonString(a:lnum - 1)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
163 while lnum > 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
164 " If we have a continuation line, or we're in a string, use line as MSL.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
165 " Otherwise, terminate search as we have found our MSL already.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
166 let line = getline(lnum)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
167
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
168 if s:Match(lnum, s:splat_regex)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
169 " If the above line looks like the "*" of a splat, use the current one's
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
170 " indentation.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
171 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
172 " Example:
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
173 " Hash[*
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
174 " method_call do
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
175 " something
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
176 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
177 return msl
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
178 elseif s:Match(line, s:non_bracket_continuation_regex) &&
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
179 \ s:Match(msl, s:non_bracket_continuation_regex)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
180 " If the current line is a non-bracket continuation and so is the
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
181 " previous one, keep its indent and continue looking for an MSL.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
182 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
183 " Example:
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
184 " method_call one,
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
185 " two,
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
186 " three
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
187 "
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
188 let msl = lnum
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
189 elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
190 \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
191 " If the current line is a bracket continuation or a block-starter, but
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
192 " the previous is a non-bracket one, respect the previous' indentation,
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
193 " and stop here.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
194 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
195 " Example:
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
196 " method_call one,
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
197 " two {
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
198 " three
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
199 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
200 return lnum
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
201 elseif s:Match(lnum, s:bracket_continuation_regex) &&
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
202 \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
203 " If both lines are bracket continuations (the current may also be a
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
204 " block-starter), use the current one's and stop here
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
205 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
206 " Example:
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
207 " method_call(
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
208 " other_method_call(
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
209 " foo
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
210 return msl
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
211 elseif s:Match(lnum, s:block_regex) &&
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
212 \ !s:Match(msl, s:continuation_regex) &&
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
213 \ !s:Match(msl, s:block_continuation_regex)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
214 " If the previous line is a block-starter and the current one is
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
215 " mostly ordinary, use the current one as the MSL.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
216 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
217 " Example:
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
218 " method_call do
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
219 " something
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
220 " something_else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
221 return msl
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
222 else
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
223 let col = match(line, s:continuation_regex) + 1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
224 if (col > 0 && !s:IsInStringOrComment(lnum, col))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
225 \ || s:IsInString(lnum, strlen(line))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
226 let msl = lnum
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
227 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
228 break
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
229 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
230 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
231
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
232 let msl_body = getline(msl)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
233 let lnum = s:PrevNonBlankNonString(lnum - 1)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
234 endwhile
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
235 return msl
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
236 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
237
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
238 " Check if line 'lnum' has more opening brackets than closing ones.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
239 function s:ExtraBrackets(lnum)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
240 let opening = {'parentheses': [], 'braces': [], 'brackets': []}
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
241 let closing = {'parentheses': [], 'braces': [], 'brackets': []}
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
242
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
243 let line = getline(a:lnum)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
244 let pos = match(line, '[][(){}]', 0)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
245
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
246 " Save any encountered opening brackets, and remove them once a matching
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
247 " closing one has been found. If a closing bracket shows up that doesn't
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
248 " close anything, save it for later.
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
249 while pos != -1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
250 if !s:IsInStringOrComment(a:lnum, pos + 1)
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
251 if line[pos] == '('
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
252 call add(opening.parentheses, {'type': '(', 'pos': pos})
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
253 elseif line[pos] == ')'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
254 if empty(opening.parentheses)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
255 call add(closing.parentheses, {'type': ')', 'pos': pos})
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
256 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
257 let opening.parentheses = opening.parentheses[0:-2]
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
258 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
259 elseif line[pos] == '{'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
260 call add(opening.braces, {'type': '{', 'pos': pos})
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
261 elseif line[pos] == '}'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
262 if empty(opening.braces)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
263 call add(closing.braces, {'type': '}', 'pos': pos})
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
264 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
265 let opening.braces = opening.braces[0:-2]
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
266 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
267 elseif line[pos] == '['
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
268 call add(opening.brackets, {'type': '[', 'pos': pos})
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
269 elseif line[pos] == ']'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
270 if empty(opening.brackets)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
271 call add(closing.brackets, {'type': ']', 'pos': pos})
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
272 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
273 let opening.brackets = opening.brackets[0:-2]
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
274 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
275 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
276 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
277
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
278 let pos = match(line, '[][(){}]', pos + 1)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
279 endwhile
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
280
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
281 " Find the rightmost brackets, since they're the ones that are important in
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
282 " both opening and closing cases
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
283 let rightmost_opening = {'type': '(', 'pos': -1}
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
284 let rightmost_closing = {'type': ')', 'pos': -1}
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
285
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
286 for opening in opening.parentheses + opening.braces + opening.brackets
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
287 if opening.pos > rightmost_opening.pos
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
288 let rightmost_opening = opening
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
289 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
290 endfor
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
291
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
292 for closing in closing.parentheses + closing.braces + closing.brackets
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
293 if closing.pos > rightmost_closing.pos
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
294 let rightmost_closing = closing
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
295 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
296 endfor
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
297
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
298 return [rightmost_opening, rightmost_closing]
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
299 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
300
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
301 function s:Match(lnum, regex)
2225
dd5c1983e355 Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
302 let col = match(getline(a:lnum), '\C'.a:regex) + 1
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
303 return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
304 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
305
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
306 function s:MatchLast(lnum, regex)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
307 let line = getline(a:lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
308 let col = match(line, '.*\zs' . a:regex)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
309 while col != -1 && s:IsInStringOrComment(a:lnum, col)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
310 let line = strpart(line, 0, col)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
311 let col = match(line, '.*' . a:regex)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
312 endwhile
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
313 return col + 1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
314 endfunction
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
315
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
316 " 3. GetRubyIndent Function {{{1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
317 " =========================
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
318
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
319 function GetRubyIndent(...)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
320 " 3.1. Setup {{{2
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
321 " ----------
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
322
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
323 " For the current line, use the first argument if given, else v:lnum
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
324 let clnum = a:0 ? a:1 : v:lnum
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
325
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
326 " Set up variables for restoring position in file. Could use clnum here.
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
327 let vcol = col('.')
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
328
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
329 " 3.2. Work on the current line {{{2
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
330 " -----------------------------
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
331
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
332 " Get the current line.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
333 let line = getline(clnum)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
334 let ind = -1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
335
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
336 " If we got a closing bracket on an empty line, find its match and indent
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
337 " according to it. For parentheses we indent to its column - 1, for the
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
338 " others we indent to the containing line's MSL's level. Return -1 if fail.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
339 let col = matchend(line, '^\s*[]})]')
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
340 if col > 0 && !s:IsInStringOrComment(clnum, col)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
341 call cursor(clnum, col)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
342 let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
343 if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 843
diff changeset
344 if line[col-1]==')' && col('.') != col('$') - 1
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
345 let ind = virtcol('.') - 1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 843
diff changeset
346 else
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
347 let ind = indent(s:GetMSL(line('.')))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 843
diff changeset
348 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
349 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
350 return ind
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
351 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
352
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
353 " If we have a =begin or =end set indent to first column.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
354 if match(line, '^\s*\%(=begin\|=end\)$') != -1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
355 return 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
356 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
357
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
358 " If we have a deindenting keyword, find its match and indent to its level.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
359 " TODO: this is messy
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
360 if s:Match(clnum, s:ruby_deindent_keywords)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
361 call cursor(clnum, 1)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
362 if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
363 \ s:end_skip_expr) > 0
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
364 let msl = s:GetMSL(line('.'))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
365 let line = getline(line('.'))
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
366
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents: 530
diff changeset
367 if strpart(line, 0, col('.') - 1) =~ '=\s*$' &&
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
368 \ strpart(line, col('.') - 1, 2) !~ 'do'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
369 let ind = virtcol('.') - 1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
370 elseif getline(msl) =~ '=\s*\(#.*\)\=$'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
371 let ind = indent(line('.'))
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
372 else
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
373 let ind = indent(msl)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
374 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
375 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
376 return ind
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
377 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
378
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
379 " If we are in a multi-line string or line-comment, don't do anything to it.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
380 if s:IsInStringOrDocumentation(clnum, matchend(line, '^\s*') + 1)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
381 return indent('.')
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
382 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
383
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
384 " If we are at the closing delimiter of a "<<" heredoc-style string, set the
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
385 " indent to 0.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
386 if line =~ '^\k\+\s*$'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
387 \ && s:IsInStringDelimiter(clnum, 1)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
388 \ && search('\V<<'.line, 'nbW') > 0
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
389 return 0
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
390 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
391
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
392 " 3.3. Work on the previous line. {{{2
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
393 " -------------------------------
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
394
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
395 " Find a non-blank, non-multi-line string line above the current line.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
396 let lnum = s:PrevNonBlankNonString(clnum - 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
398 " If the line is empty and inside a string, use the previous line.
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
399 if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
400 return indent(prevnonblank(clnum))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
401 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
402
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 " At the start of the file use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
408 " Set up variables for the previous line.
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
409 let line = getline(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
410 let ind = indent(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
411
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
412 " If the previous line ended with a block opening, add a level of indent.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
413 if s:Match(lnum, s:block_regex)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
414 return indent(s:GetMSL(lnum)) + &sw
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
415 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
416
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
417 " If the previous line ended with the "*" of a splat, add a level of indent
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
418 if line =~ s:splat_regex
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
419 return indent(lnum) + &sw
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
420 endif
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
421
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
422 " If the previous line contained unclosed opening brackets and we are still
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
423 " in them, find the rightmost one and add indent depending on the bracket
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
424 " type.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
425 "
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
426 " If it contained hanging closing brackets, find the rightmost one, find its
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
427 " match and indent according to that.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
428 if line =~ '[[({]' || line =~ '[])}]\s*\%(#.*\)\=$'
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
429 let [opening, closing] = s:ExtraBrackets(lnum)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
430
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
431 if opening.pos != -1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
432 if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
433 if col('.') + 1 == col('$')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
434 return ind + &sw
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
435 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
436 return virtcol('.')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
437 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 843
diff changeset
438 else
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
439 let nonspace = matchend(line, '\S', opening.pos + 1) - 1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
440 return nonspace > 0 ? nonspace : ind + &sw
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 843
diff changeset
441 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
442 elseif closing.pos != -1
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
443 call cursor(lnum, closing.pos + 1)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
444 normal! %
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
445
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
446 if s:Match(line('.'), s:ruby_indent_keywords)
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
447 return indent('.') + &sw
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
448 else
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
449 return indent('.')
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
450 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
451 else
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
452 call cursor(clnum, vcol)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
453 end
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
456 " If the previous line ended with an "end", match that "end"s beginning's
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
457 " indent.
1212
e085b0f7b036 updated for version 7.1b
vimboss
parents: 1121
diff changeset
458 let col = s:Match(lnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$')
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
459 if col > 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
460 call cursor(lnum, col)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
461 if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW',
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
462 \ s:end_skip_expr) > 0
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
463 let n = line('.')
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
464 let ind = indent('.')
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
465 let msl = s:GetMSL(n)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
466 if msl != n
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
467 let ind = indent(msl)
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
468 end
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
469 return ind
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
470 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
471 end
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
472
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
473 let col = s:Match(lnum, s:ruby_indent_keywords)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
474 if col > 0
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
475 call cursor(lnum, col)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
476 let ind = virtcol('.') - 1 + &sw
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
477 " TODO: make this better (we need to count them) (or, if a searchpair
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
478 " fails, we know that something is lacking an end and thus we indent a
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
479 " level
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
480 if s:Match(lnum, s:end_end_regex)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
481 let ind = indent('.')
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
482 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
483 return ind
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
486 " 3.4. Work on the MSL line. {{{2
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
487 " --------------------------
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
488
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
489 " Set up variables to use and search for MSL to the previous line.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
490 let p_lnum = lnum
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
491 let lnum = s:GetMSL(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
492
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
493 " If the previous line wasn't a MSL and is continuation return its indent.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
494 " TODO: the || s:IsInString() thing worries me a bit.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
495 if p_lnum != lnum
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
496 if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line))
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
497 return ind
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
498 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
501 " Set up more variables, now that we know we wasn't continuation bound.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
502 let line = getline(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
503 let msl_ind = indent(lnum)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
504
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
505 " If the MSL line had an indenting keyword in it, add a level of indent.
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
506 " TODO: this does not take into account contrived things such as
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
507 " module Foo; class Bar; end
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
508 if s:Match(lnum, s:ruby_indent_keywords)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
509 let ind = msl_ind + &sw
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
510 if s:Match(lnum, s:end_end_regex)
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
511 let ind = ind - &sw
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
512 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
513 return ind
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
516 " If the previous line ended with [*+/.,-=], but wasn't a block ending or a
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
517 " closing bracket, indent one extra level.
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
518 if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
519 if lnum == p_lnum
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
520 let ind = msl_ind + &sw
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
521 else
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
522 let ind = msl_ind
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
523 endif
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
524 return ind
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
525 endif
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
526
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
527 " }}}2
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
528
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531
530
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
532 " }}}1
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
533
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
534 let &cpo = s:cpo_save
339999b511a0 updated for version 7.0148
vimboss
parents: 7
diff changeset
535 unlet s:cpo_save
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 843
diff changeset
536
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2225
diff changeset
537 " vim:set sw=2 sts=2 ts=8 et: