annotate runtime/indent/sml.vim @ 11688:570f00932da8 v8.0.0727

patch 8.0.0727: message about what register to yank into is not translated commit https://github.com/vim/vim/commit/60d0e97497f1104b31f711072ef174af533b61fa Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 16 20:54:34 2017 +0200 patch 8.0.0727: message about what register to yank into is not translated Problem: Message about what register to yank into is not translated. (LemonBoy) Solution: Add _().
author Christian Brabandt <cb@256bit.org>
date Sun, 16 Jul 2017 21:00:03 +0200
parents 63b0b7b79b25
children 6dd88e45d47d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
1 " Vim indent file
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
2 " Language: SML
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
3 " Maintainer: Saikat Guha <sg266@cornell.edu>
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
4 " Hubert Chao <hc85@cornell.edu>
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
5 " Original OCaml Version:
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
6 " Jean-Francois Yuen <jfyuen@ifrance.com>
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
7 " Mike Leary <leary@nwlink.com>
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
8 " Markus Mottl <markus@oefai.at>
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
9 " OCaml URL: http://www.oefai.at/~markus/vim/indent/ocaml.vim
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
10 " Last Change: 2003 Jan 04 - Adapted to SML
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
11 " 2002 Nov 06 - Some fixes (JY)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
12 " 2002 Oct 28 - Fixed bug with indentation of ']' (MM)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
13 " 2002 Oct 22 - Major rewrite (JY)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
14
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
15 " Only load this indent file when no other was loaded.
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
16 if exists("b:did_indent")
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
17 finish
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
18 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
19 let b:did_indent = 1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
20
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
21 setlocal expandtab
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
22 setlocal indentexpr=GetSMLIndent()
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
23 setlocal indentkeys+=0=and,0=else,0=end,0=handle,0=if,0=in,0=let,0=then,0=val,0=fun,0=\|,0=*),0)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
24 setlocal nolisp
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
25 setlocal nosmartindent
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
26 setlocal textwidth=80
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
27 setlocal shiftwidth=2
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
28
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
29 " Comment formatting
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
30 if (has("comments"))
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
31 set comments=sr:(*,mb:*,ex:*)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
32 set fo=cqort
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
33 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
34
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
35 " Only define the function once.
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
36 "if exists("*GetSMLIndent")
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
37 "finish
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
38 "endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
39
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
40 " Define some patterns:
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
41 let s:beflet = '^\s*\(initializer\|method\|try\)\|\(\<\(begin\|do\|else\|in\|then\|try\)\|->\|;\)\s*$'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
42 let s:letpat = '^\s*\(let\|type\|module\|class\|open\|exception\|val\|include\|external\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
43 let s:letlim = '\(\<\(sig\|struct\)\|;;\)\s*$'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
44 let s:lim = '^\s*\(exception\|external\|include\|let\|module\|open\|type\|val\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
45 let s:module = '\<\%(let\|sig\|struct\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
46 let s:obj = '^\s*\(constraint\|inherit\|initializer\|method\|val\)\>\|\<\(object\|object\s*(.*)\)\s*$'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
47 let s:type = '^\s*\%(let\|type\)\>.*='
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
48 let s:val = '^\s*\(val\|external\)\>.*:'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
49
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
50 " Skipping pattern, for comments
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
51 function! s:SkipPattern(lnum, pat)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
52 let def = prevnonblank(a:lnum - 1)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
53 while def > 0 && getline(def) =~ a:pat
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
54 let def = prevnonblank(def - 1)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
55 endwhile
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
56 return def
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
57 endfunction
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
58
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
59 " Indent for ';;' to match multiple 'let'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
60 function! s:GetInd(lnum, pat, lim)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
61 let llet = search(a:pat, 'bW')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
62 let old = indent(a:lnum)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
63 while llet > 0
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
64 let old = indent(llet)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
65 let nb = s:SkipPattern(llet, '^\s*(\*.*\*)\s*$')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
66 if getline(nb) =~ a:lim
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
67 return old
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
68 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
69 let llet = search(a:pat, 'bW')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
70 endwhile
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
71 return old
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
72 endfunction
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
73
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
74 " Indent pairs
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
75 function! s:FindPair(pstart, pmid, pend)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
76 call search(a:pend, 'bW')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
77 " return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'))
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
78 let lno = searchpair(a:pstart, a:pmid, a:pend, 'bW', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
79 if lno == -1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
80 return indent(lno)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
81 else
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
82 return col(".") - 1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
83 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
84 endfunction
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
85
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
86 function! s:FindLet(pstart, pmid, pend)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
87 call search(a:pend, 'bW')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
88 " return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'))
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
89 let lno = searchpair(a:pstart, a:pmid, a:pend, 'bW', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
90 let moduleLine = getline(lno)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
91 if lno == -1 || moduleLine =~ '^\s*\(fun\|structure\|signature\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
92 return indent(lno)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
93 else
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
94 return col(".") - 1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
95 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
96 endfunction
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
97
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
98 " Indent 'let'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
99 "function! s:FindLet(pstart, pmid, pend)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
100 " call search(a:pend, 'bW')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
101 " return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\<in\\s*$" || getline(prevnonblank(".") - 1) =~ "^\\s*let\\>.*=\\s*$\\|" . s:beflet'))
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
102 "endfunction
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
103
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
104 function! GetSMLIndent()
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
105 " Find a non-blank line above the current line.
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
106 let lnum = prevnonblank(v:lnum - 1)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
107
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
108 " At the start of the file use zero indent.
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
109 if lnum == 0
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
110 return 0
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
111 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
112
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
113 let ind = indent(lnum)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
114 let lline = getline(lnum)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
115
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
116 " Return double 'shiftwidth' after lines matching:
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
117 if lline =~ '^\s*|.*=>\s*$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
118 return ind + 2 *shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
119 elseif lline =~ '^\s*val\>.*=\s*$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
120 return ind + shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
121 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
122
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
123 let line = getline(v:lnum)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
124
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
125 " Indent lines starting with 'end' to matching module
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
126 if line =~ '^\s*end\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
127 return s:FindLet(s:module, '', '\<end\>')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
128
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
129 " Match 'else' with 'if'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
130 elseif line =~ '^\s*else\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
131 if lline !~ '^\s*\(if\|else\|then\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
132 return s:FindPair('\<if\>', '', '\<then\>')
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 532
diff changeset
133 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 532
diff changeset
134 return ind
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
135 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
136
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
137 " Match 'then' with 'if'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
138 elseif line =~ '^\s*then\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
139 if lline !~ '^\s*\(if\|else\|then\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
140 return s:FindPair('\<if\>', '', '\<then\>')
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 532
diff changeset
141 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 532
diff changeset
142 return ind
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
143 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
144
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
145 " Indent if current line begins with ']'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
146 elseif line =~ '^\s*\]'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
147 return s:FindPair('\[','','\]')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
148
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
149 " Indent current line starting with 'in' to last matching 'let'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
150 elseif line =~ '^\s*in\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
151 let ind = s:FindLet('\<let\>','','\<in\>')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
152
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
153 " Indent from last matching module if line matches:
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
154 elseif line =~ '^\s*\(fun\|val\|open\|structure\|and\|datatype\|type\|exception\)\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
155 cursor(lnum,1)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
156 let lastModule = indent(searchpair(s:module, '', '\<end\>', 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'))
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
157 if lastModule == -1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
158 return 0
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
159 else
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
160 return lastModule + shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
161 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
162
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
163 " Indent lines starting with '|' from matching 'case', 'handle'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
164 elseif line =~ '^\s*|'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
165 " cursor(lnum,1)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
166 let lastSwitch = search('\<\(case\|handle\|fun\|datatype\)\>','bW')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
167 let switchLine = getline(lastSwitch)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
168 let switchLineIndent = indent(lastSwitch)
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
169 if lline =~ '^\s*|'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
170 return ind
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
171 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
172 if switchLine =~ '\<case\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
173 return col(".") + 2
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
174 elseif switchLine =~ '\<handle\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
175 return switchLineIndent + shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
176 elseif switchLine =~ '\<datatype\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
177 call search('=')
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
178 return col(".") - 1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
179 else
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
180 return switchLineIndent + 2
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
181 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
182
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
183
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
184 " Indent if last line ends with 'sig', 'struct', 'let', 'then', 'else',
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
185 " 'in'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
186 elseif lline =~ '\<\(sig\|struct\|let\|in\|then\|else\)\s*$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
187 let ind = ind + shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
188
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
189 " Indent if last line ends with 'of', align from 'case'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
190 elseif lline =~ '\<\(of\)\s*$'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
191 call search('\<case\>',"bW")
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
192 let ind = col(".")+4
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
193
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
194 " Indent if current line starts with 'of'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
195 elseif line =~ '^\s*of\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
196 call search('\<case\>',"bW")
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
197 let ind = col(".")+1
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
198
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
199
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
200 " Indent if last line starts with 'fun', 'case', 'fn'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
201 elseif lline =~ '^\s*\(fun\|fn\|case\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
202 let ind = ind + shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
203
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
204 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
205
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
206 " Don't indent 'let' if last line started with 'fun', 'fn'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
207 if line =~ '^\s*let\>'
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
208 if lline =~ '^\s*\(fun\|fn\)'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 839
diff changeset
209 let ind = ind - shiftwidth()
532
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
210 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
211 endif
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
212
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
213 return ind
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
214
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
215 endfunction
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
216
7052f11a3dc9 updated for version 7.0150
vimboss
parents:
diff changeset
217 " vim:sw=2