Mercurial > vim
annotate runtime/indent/testdir/vim.ok @ 35172:c98f002b1fe4 default tip
runtime(doc): fix typo in usr_52.txt
Commit: https://github.com/vim/vim/commit/b7258738f80f26be302a84a99f968b3bdc2f29bb
Author: Christian Brabandt <cb@256bit.org>
Date: Sun May 12 19:04:47 2024 +0200
runtime(doc): fix typo in usr_52.txt
fixes: https://github.com/vim/vim/issues/14758
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 12 May 2024 19:15:08 +0200 |
parents | 5b46a975e48a |
children |
rev | line source |
---|---|
14970
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " vim: set ft=vim sw=4 : |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 " START_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 func Some() |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 let x = 1 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 endfunc |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 let cmd = |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 \ 'some ' |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 \ 'string' |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 |
23737 | 12 if 1 |
13 let x = [ | |
14 \ ] | |
15 endif | |
16 | |
23931 | 17 for x in [ |
18 {key: 'value'}, | |
19 ] | |
20 eval 0 | |
21 endfor | |
22 | |
29274 | 23 let t = [ |
24 \ { | |
25 \ 'k': 'val', | |
26 \ }, | |
27 \ ] | |
28 | |
30085 | 29 def Func() |
30 var d = dd | |
30547 | 31 ->extend({ |
32 }) | |
30085 | 33 eval 0 |
34 enddef | |
14970
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 " END_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 " START_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 " INDENT_EXE let g:vim_indent_cont = 6 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 let cmd = |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 \ 'some ' |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 \ 'string' |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 " END_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 " START_INDENT |
23573 | 47 " INDENT_EXE let g:vim_indent_cont = 5 |
48 | |
49 let list = [ | |
50 \ 'one', | |
51 \ 'two'] | |
52 | |
53 " END_INDENT | |
54 | |
55 " START_INDENT | |
14970
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 " INDENT_EXE unlet g:vim_indent_cont |
23573 | 57 |
58 let list = [ | |
59 'one', | |
60 'two', | |
30547 | 61 ] |
23573 | 62 echo |
63 | |
64 " END_INDENT | |
65 | |
66 " START_INDENT | |
14970
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 " INDENT_AT this-line |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 func Some() |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 let f = x " this-line |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 endfunc |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 " END_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 " START_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
74 " INDENT_NEXT next-line |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 func Some() |
30547 | 76 " next-line |
77 let f = x | |
14970
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
78 endfunc |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
79 " END_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
80 |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 " START_INDENT |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
82 " INDENT_PREV prev-line |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
83 func Some() |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 let f = x |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
85 " prev-line |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
86 endfunc |
19b757c6c6a7
patch 8.1.0496: no tests for indent files
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
87 " END_INDENT |
18489 | 88 |
89 " START_INDENT | |
90 let a =<< END | |
30547 | 91 nothing |
92 END | |
93 " END_INDENT | |
94 | |
95 " START_INDENT | |
96 let a =<< trim END | |
18489 | 97 nothing |
98 END | |
99 " END_INDENT | |
100 | |
101 " START_INDENT | |
102 " INDENT_AT this-line | |
103 let a=<< trim END | |
104 blah | |
105 blah | |
106 blah this-line | |
107 END | |
108 " END_INDENT | |
30547 | 109 |
110 " START_INDENT | |
111 if v:true | |
112 echo 0 | |
113 end | |
114 " END_INDENT | |
115 | |
116 " START_INDENT | |
117 var result = Func( | |
118 arg1, | |
119 arg2 | |
120 ) | |
121 " END_INDENT | |
122 | |
123 " START_INDENT | |
124 var result = Func(arg1, | |
125 arg2) | |
126 " END_INDENT | |
127 | |
128 " START_INDENT | |
129 filter(list, (k, v) => | |
130 v > 0) | |
131 " END_INDENT | |
132 | |
133 " START_INDENT | |
134 filter(list, (k, v) => { | |
135 const x = get(list, k, 0) | |
136 return x > 0 | |
137 }) | |
138 " END_INDENT | |
139 | |
140 " START_INDENT | |
141 if x > 0 | |
142 filter(list, (k, v) => { | |
143 const x = get(list, k, 1) | |
144 return x > 0 | |
145 }) | |
146 endif | |
147 " END_INDENT | |
148 | |
149 " START_INDENT | |
150 { | |
151 var temp = 'temp' | |
152 } | |
153 " END_INDENT | |
154 | |
155 " START_INDENT | |
156 var text = lead | |
157 .. middle | |
158 .. end | |
159 " END_INDENT | |
160 | |
161 " START_INDENT | |
162 var text = lead .. | |
163 middle .. | |
164 end | |
165 " END_INDENT | |
166 | |
167 " START_INDENT | |
168 var total = start + | |
169 end - | |
170 correction | |
171 " END_INDENT | |
172 | |
173 " START_INDENT | |
174 var result = start | |
175 :+ print | |
176 " END_INDENT | |
177 | |
178 " START_INDENT | |
179 var result = positive | |
180 ? PosFunc(arg) | |
181 : NegFunc(arg) | |
182 " END_INDENT | |
183 | |
184 " START_INDENT | |
185 var result = GetBuilder() | |
186 ->BuilderSetWidth(333) | |
187 ->BuilderSetHeight(777) | |
188 ->BuilderBuild() | |
189 " END_INDENT | |
190 | |
191 " START_INDENT | |
192 var result = MyDict | |
193 .member | |
194 " END_INDENT | |
195 | |
196 " START_INDENT | |
197 autocmd BufNewFile *.match if condition | |
198 | echo 'match' | |
199 | endif | |
200 " END_INDENT | |
201 | |
202 " START_INDENT | |
203 set cpo+=C | |
204 var lines =<< trim END | |
205 | this works | |
206 END | |
207 set cpo-=C | |
208 " END_INDENT | |
209 | |
210 " START_INDENT | |
211 syn region Text | |
212 \ start='foo' | |
213 #\ comment | |
214 \ end='bar' | |
215 " END_INDENT | |
216 | |
217 " START_INDENT | |
218 au CursorHold * echom 'BEFORE bar' | |
219 #\ some comment | |
220 | echom 'AFTER bar' | |
221 " END_INDENT | |
222 | |
223 " START_INDENT | |
224 def MyFunc(text: string, | |
225 separator = '-' | |
226 ): string | |
227 enddef | |
228 " END_INDENT | |
229 | |
230 " START_INDENT | |
231 def MyFunc( | |
232 text: string, | |
233 separator = '-' | |
234 ): string | |
235 enddef | |
236 " END_INDENT | |
237 | |
238 " START_INDENT | |
239 [var1, var2] = | |
240 Func() | |
241 " END_INDENT | |
242 | |
243 " START_INDENT | |
244 const list = ['one', | |
245 'two'] | |
246 " END_INDENT | |
247 | |
248 " START_INDENT | |
249 const list = [ | |
250 'one', | |
251 'two', | |
252 ] | |
253 " END_INDENT | |
254 | |
255 " START_INDENT | |
256 const dict = {one: 1, | |
257 two: 2 | |
258 } | |
259 " END_INDENT | |
260 | |
261 " START_INDENT | |
262 const dict = { | |
263 one: 1, | |
264 two: 2 | |
265 } | |
266 " END_INDENT | |
267 | |
268 " START_INDENT | |
269 if true | |
270 const dict = | |
271 { | |
272 one: 1, | |
273 two: 2 | |
274 } | |
275 endif | |
276 " END_INDENT | |
277 | |
278 " START_INDENT | |
279 def Func() | |
280 return { | |
281 one: 1 | |
282 } | |
283 enddef | |
284 " END_INDENT | |
285 | |
286 " START_INDENT | |
287 echo { | |
288 a: 0, | |
289 # b | |
290 # c | |
291 } | |
292 " END_INDENT | |
293 | |
294 " START_INDENT | |
295 echo search( | |
296 # comment | |
297 '1' | |
298 .. '2' | |
299 ) | |
300 " END_INDENT | |
301 | |
302 " START_INDENT | |
303 if true | |
304 var v = ( # trailing "(" starts line continuation | |
305 3 + 4 # nothing special | |
306 ) # end of expression indicates continued line | |
307 var x: number # needs to align with previous "var" | |
308 endif | |
309 " END_INDENT | |
310 | |
311 " START_INDENT | |
312 def Func() # {{{ | |
313 # comment | |
314 if true | |
315 return | |
316 endif | |
317 enddef | |
318 " END_INDENT | |
319 | |
320 " START_INDENT | |
321 echo { | |
322 key: | |
323 'value', | |
324 } | |
325 " END_INDENT | |
326 | |
327 " START_INDENT | |
328 var id = time | |
329 ->timer_start((_) => { | |
330 n = 0 | |
331 }) | |
332 " END_INDENT | |
333 | |
334 " START_INDENT | |
335 augroup Name | |
336 autocmd! | |
337 augroup END | |
338 " END_INDENT | |
339 | |
340 " START_INDENT | |
341 var n = | |
342 # comment | |
343 1 | |
344 + 2 | |
345 | |
346 var s = '' | |
347 " END_INDENT | |
348 | |
349 " START_INDENT | |
350 var keys = { | |
351 J: 'j', | |
352 "\<Home>": '1G', | |
353 "\<End>": 'G', | |
354 z: 'zz' | |
355 } | |
356 " END_INDENT | |
357 | |
358 " START_INDENT | |
359 export def Func( | |
360 n: number, | |
361 s: string, | |
362 ...l: list<bool> | |
363 ) | |
364 enddef | |
365 " END_INDENT | |
366 | |
367 " START_INDENT | |
368 var heredoc =<< trim ENDD | |
369 var nested_heredoc =<< trim END | |
370 END | |
371 ENDD | |
372 " END_INDENT | |
373 | |
374 " START_INDENT | |
375 if true | |
376 else " comment | |
377 endif | |
378 " END_INDENT | |
379 | |
380 " START_INDENT | |
381 if true | echo 'one' | endif | |
382 if true | echo 'two' | endif | |
383 if true | echo 'three' | endif | |
384 " END_INDENT | |
385 | |
386 " START_INDENT | |
387 if true | |
388 :'<-1 mark < | |
389 else | |
390 echo '' | |
391 endif | |
392 " END_INDENT | |
393 | |
394 " START_INDENT | |
395 substitute/pat /rep / | |
396 echo | |
397 " END_INDENT | |
398 | |
399 " START_INDENT | |
400 try | |
401 echo 1 | |
402 catch /pat / # comment | |
403 echo 2 | |
404 endtry | |
405 " END_INDENT | |
406 | |
407 " START_INDENT | |
408 def Func() | |
409 Cmd % | |
410 enddef | |
411 " END_INDENT | |
412 | |
413 " START_INDENT | |
414 if end == 'xxx' || end == 'yyy' | |
415 echo | |
416 endif | |
417 " END_INDENT | |
418 | |
419 " START_INDENT | |
420 if true | |
421 popup_move(id, {col: 1, | |
422 line: 2}) | |
423 endif | |
424 setwinvar(id, 'name', 3) | |
425 " END_INDENT | |
426 | |
427 " START_INDENT | |
428 var d = [ | |
429 {a: 'x', | |
430 b: 'y'}, | |
431 FuncA(), | |
432 FuncB(), | |
433 ] | |
434 " END_INDENT | |
435 | |
436 " START_INDENT | |
437 var ll = [[ | |
438 1, | |
439 2, | |
440 3], [ | |
441 4, | |
442 5, | |
443 6], [ | |
444 7, | |
445 8, | |
446 9]] | |
447 " END_INDENT | |
448 | |
449 " START_INDENT | |
450 var ld = [{ | |
451 a: 'xxx', | |
452 b: 'yyy'}, { | |
453 c: 'xxx', | |
454 d: 'yyy'}, { | |
455 e: 'xxx', | |
456 f: 'yyy'}, { | |
457 }] | |
458 " END_INDENT | |
459 | |
460 " START_INDENT | |
461 var d = { | |
462 a: { | |
463 b: { | |
464 c: [{ | |
465 d: 'e', | |
466 f: 'g', | |
467 h: 'i' | |
468 }], | |
469 j: 'k', | |
470 }, | |
471 }, | |
472 } | |
473 " END_INDENT | |
474 | |
475 " START_INDENT | |
476 if true | |
477 var end: any | |
478 if true | |
479 end = 0 | |
480 elseif true | |
481 echo | |
482 endif | |
483 endif | |
484 " END_INDENT | |
485 | |
486 " START_INDENT | |
32721 | 487 if true |
488 var d = { | |
489 end: 0} | |
490 endif | |
491 " END_INDENT | |
492 | |
493 " START_INDENT | |
30547 | 494 nunmap <buffer> ( |
495 nunmap <buffer> ) | |
496 inoremap [ { | |
497 inoremap ] } | |
498 silent! xunmap i{ | |
499 silent! xunmap a{ | |
500 " END_INDENT | |
501 | |
502 " START_INDENT | |
503 def Func( | |
504 s: string, | |
505 n = 1, | |
506 m = 2 | |
507 ) | |
508 enddef | |
509 " END_INDENT | |
510 | |
511 " START_INDENT | |
512 var h =<< END | |
513 text | |
514 END | |
515 | |
516 def Func() | |
517 echo | |
518 enddef | |
519 " END_INDENT | |
520 | |
521 " START_INDENT | |
522 def Func() | |
523 var h =<< END | |
524 text | |
525 END | |
526 echo 'test' | |
527 enddef | |
528 " END_INDENT | |
529 | |
530 " START_INDENT | |
531 def Foo() | |
532 lcd - | |
533 enddef | |
534 def Bar() | |
535 echo | |
536 enddef | |
537 " END_INDENT | |
538 | |
539 " START_INDENT | |
540 if true | |
541 n = Func(1, 2, | |
542 3) | |
543 endif | |
544 " END_INDENT | |
545 | |
546 " START_INDENT | |
547 def Func(s: string, | |
548 n: number): bool | |
549 if true | |
550 return false | |
551 endif | |
552 enddef | |
553 " END_INDENT | |
554 | |
555 " START_INDENT | |
556 def Func( | |
557 n: number) | |
558 # | |
559 echo | |
560 enddef | |
561 " END_INDENT | |
562 | |
563 " START_INDENT | |
564 " INDENT_AT this-line | |
565 def Func( | |
566 n: number) | |
567 # | |
568 echo # this-line | |
569 enddef | |
570 " END_INDENT | |
571 | |
572 " START_INDENT | |
573 if true | |
574 if true | |
575 normal! == | |
576 endif | |
577 endif | |
578 " END_INDENT | |
579 | |
580 " START_INDENT | |
581 var d = { | |
582 a: () => true, | |
583 b: () => true | |
584 && true | |
585 && Foo(), | |
586 c: () => Bar(), | |
587 e: () => Baz(), | |
588 } | |
589 " END_INDENT | |
590 | |
591 " START_INDENT | |
592 def Select(Cont: func(func(any)), Pred: func(any): bool): func(func(any)) | |
593 return (Emit: func(any)) => { | |
594 Cont((t: any) => { | |
595 if Pred(t) | |
596 Emit(t) | |
597 endif | |
598 }) | |
599 } | |
600 enddef | |
601 " END_INDENT | |
602 | |
603 " START_INDENT | |
604 " INDENT_EXE let g:vim_indent = {'more_in_bracket_block': v:true} | |
605 def Select(Cont: func(func(any)), Pred: func(any): bool): func(func(any)) | |
606 return (Emit: func(any)) => { | |
607 Cont((t: any) => { | |
608 if Pred(t) | |
609 Emit(t) | |
610 endif | |
611 }) | |
612 } | |
613 enddef | |
614 " END_INDENT | |
615 | |
616 " START_INDENT | |
617 " INDENT_EXE unlet! g:vim_indent | |
618 " END_INDENT | |
619 | |
620 " START_INDENT | |
621 g:lightline = { | |
622 'active': { | |
623 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'relativepath', 'modified' ] ], | |
624 }, | |
625 'inactive': { | |
626 'left': [ [ 'readonly', 'relativepath', 'modified' ] ], | |
627 } | |
628 } | |
629 " END_INDENT | |
630 | |
631 " START_INDENT | |
632 if getline(1, 10) | |
633 ->map((_, v: string): number => strcharlen(v)) | |
634 ->max() > 1'000 | |
635 &l:breakindent = false | |
636 &l:linebreak = false | |
637 else | |
638 &l:breakindent = true | |
639 &l:linebreak = true | |
640 endif | |
641 " END_INDENT | |
642 | |
643 " START_INDENT | |
644 var ext2cmd: dict<string> = { | |
645 doc: $'antiword {fname}', | |
646 docx: $'pandoc --from=docx --to=markdown {fname}', | |
647 epub: $'pandoc --from=epub --to=markdown {fname}', | |
648 odp: $'odt2txt {fname}', | |
649 odt: $'odt2txt {fname}', | |
650 pdf: $'pdftotext -nopgbrk -layout -q -eol unix {fname} -', | |
651 rtf: 'unrtf --text', | |
652 } | |
653 " END_INDENT | |
654 | |
655 " START_INDENT | |
656 const ptybuf: number = term_start(&shell, { | |
657 hidden: true, | |
658 exit_cb: (_, _) => { | |
659 if true | |
660 close | |
661 else | |
662 help | |
663 endif | |
664 } | |
665 }) | |
666 " END_INDENT | |
667 | |
668 " START_INDENT | |
669 var d = { | |
670 a: 0, | |
671 # a ' quote {{{ | |
672 #}}} | |
673 b: 0, | |
674 } | |
675 " END_INDENT | |
676 | |
677 " START_INDENT | |
678 echo printf('%s () %s', | |
679 1, | |
680 2 | |
681 ) | |
682 " END_INDENT | |
683 | |
684 " START_INDENT | |
685 prop_add(1, col('.'), { | |
686 length: 2, | |
687 type: 'test' | |
688 }) | |
689 " END_INDENT | |
690 | |
691 " START_INDENT | |
692 echo (() => " string starting with space")() | |
693 echo | |
694 " END_INDENT | |
695 | |
696 " START_INDENT | |
697 var variables = deepcopy(g:) | |
698 ->filter((k: string, _): bool => | |
699 k =~ '\c\V' .. keyword->escape('\') | |
700 && k !~ '\%(loaded\|did_plugin_\)') | |
701 ->items() | |
702 ->map((_, v): string => v[0] .. ' = ' .. string(v[1])) | |
703 new | |
704 " END_INDENT | |
705 | |
706 " START_INDENT | |
707 var d = freq | |
708 ->map((_, v) => | |
709 v * ( | |
710 1 | |
711 + 2 | |
712 )) | |
713 for item in d | |
714 ->items() | |
715 ->sort((a, b) => b[1] - a[1]) | |
716 echo | |
717 endfor | |
718 " END_INDENT | |
719 | |
720 " START_INDENT | |
721 make_job = job_start([&shell, &shellcmdflag, make_cmd], { | |
722 callback: function(MakeProcessOutput, [qfid]), | |
723 close_cb: function(MakeCloseCb, [qfid]), | |
724 exit_cb: MakeCompleted, | |
725 in_io: 'null' | |
726 }) | |
727 " END_INDENT | |
728 | |
729 " START_INDENT | |
730 var matching_abbrev: list<dict<string>> = copy(ABBREV) | |
731 ->filter((_, v: dict<string>): bool => | |
732 stridx(v.lhs, word_to_complete) == 0) | |
733 ->map((_, v: dict<string>) => ({ | |
734 word: v.lhs, | |
735 menu: AbbrevRhs(v.rhs)->stridx('expand_') >= 0 | |
736 ? AbbrevRhs(v.rhs)->matchstr('.*,\s*''\zs.*\ze'')') | |
737 : AbbrevRhs(v.rhs) | |
738 })) | |
739 " END_INDENT | |
740 | |
741 " START_INDENT | |
742 def Func() | |
743 if true | |
744 vimgrep /^\C\s*\%(fu\%[nction]\|def\)\s\+/ file | |
745 endif | |
746 enddef | |
747 " END_INDENT | |
748 | |
749 " START_INDENT | |
750 setlocal iskeyword+=[ | |
751 cword = expand('<cword>') | |
752 " END_INDENT | |
753 | |
754 " START_INDENT | |
755 silent if true | |
756 echo | |
757 endif | |
758 " END_INDENT | |
759 | |
760 " START_INDENT | |
761 def Func() | |
762 sort :^.*[\/]: | |
763 enddef | |
764 " END_INDENT | |
765 | |
766 " START_INDENT | |
767 def Func() | |
768 d = { | |
769 } | |
770 hd =<< trim END | |
771 [' | |
772 ]' | |
773 END | |
774 enddef | |
775 " END_INDENT | |
776 | |
777 " START_INDENT | |
778 def Func() | |
779 if true | |
780 var hd =<< trim END | |
781 if get(b:, 'current_syntax', '') | |
782 endif | |
783 END | |
784 elseif true | |
785 echo | |
786 endif | |
787 enddef | |
788 " END_INDENT | |
789 | |
790 " START_INDENT | |
791 # test for control-flow keyword followed by commented fold marker {{{ | |
792 if true | |
793 echo | |
794 endif #}}} | |
795 " END_INDENT | |
796 | |
797 " START_INDENT | |
798 if winsz == 0|let winsz= ""|endif | |
799 exe "noswapfile ".winsz."wincmd s" | |
800 " END_INDENT | |
801 | |
802 " START_INDENT | |
803 if true | |
804 if true | |
805 windo if true | echo | endif | |
806 augroup Name | |
807 autocmd WinLeave * if true | eval 1 + 2 | endif | |
808 augroup END | |
809 endif | |
810 endif | |
811 " END_INDENT | |
812 | |
813 " START_INDENT | |
814 if true | |
815 echo ' =<< trim END' | |
816 ->len() | |
817 endif | |
818 " END_INDENT | |
819 | |
820 " START_INDENT | |
821 function Func() | |
822 if true | |
823 if true | |
824 if true | echo com | endif | |
825 if true | echo com | endif | |
826 endif | |
827 else | |
828 endif | |
829 endfunction | |
830 " END_INDENT | |
831 | |
832 " START_INDENT | |
833 function Func() | |
834 if v:true | |
835 + | |
836 echo | |
837 - | |
838 endif | |
839 endfunction | |
840 " END_INDENT | |
841 | |
842 " START_INDENT | |
843 var matchpairs: string = &matchpairs | |
844 var pairs: dict<list<string>> | |
845 for [opening: string, closing: string] | |
846 in matchpairs | |
847 ->split(',') | |
848 ->map((_, v: string): list<string> => split(v, ':')) | |
849 pairs[opening] = [escape(opening, '[]'), escape(closing, '[]'), 'nW', 'w$'] | |
850 pairs[closing] = [escape(opening, '[]'), escape(closing, '[]'), 'bnW', 'w0'] | |
851 endfor | |
852 " END_INDENT | |
853 | |
854 " START_INDENT | |
855 { | |
856 echo [] | |
857 + [] | |
858 + [{a: 1, | |
30875 | 859 b: 2}] |
30547 | 860 } |
861 " END_INDENT | |
862 | |
863 " START_INDENT | |
864 silent! argdel * | |
865 edit file | |
866 " END_INDENT | |
30634 | 867 |
868 " START_INDENT | |
869 def Foo() | |
870 Bar(1, | |
871 []->filter((_, v) => { | |
872 return true | |
873 }), | |
874 () => { | |
875 echo | |
876 }) | |
877 enddef | |
878 " END_INDENT | |
30875 | 879 |
880 " START_INDENT | |
881 echo { | |
882 k: () => { | |
883 if true | |
884 echo | |
885 popup_setoptions(id, | |
886 {title: 'title'}) | |
887 endif | |
888 } | |
889 } | |
890 " END_INDENT | |
891 | |
892 " START_INDENT | |
893 if true | |
894 elseif | |
895 endif | |
896 " END_INDENT | |
31885 | 897 |
898 " START_INDENT | |
899 if ( | |
900 true) | |
901 && true | |
902 echo | |
903 endif | |
904 " END_INDENT | |
905 | |
906 " START_INDENT | |
907 abstract class Shape | |
908 this.color = Color.Black | |
909 this.thickness = 10 | |
910 endclass | |
911 " END_INDENT | |
912 | |
913 " START_INDENT | |
914 class OtherThing | |
915 this.size: number | |
916 static totalSize: number | |
917 | |
918 static def ClearTotalSize(): number | |
919 var prev = totalSize | |
920 totalSize = 0 | |
921 return prev | |
922 enddef | |
923 endclass | |
924 " END_INDENT | |
925 | |
926 " START_INDENT | |
927 interface HasSurface | |
928 this.size: number | |
929 def Surface(): number | |
930 endinterface | |
931 " END_INDENT | |
932 | |
933 " START_INDENT | |
934 interface EnterExit | |
935 def Enter(): void | |
936 def Exit(): void | |
937 endinterface | |
938 " END_INDENT | |
939 | |
940 " START_INDENT | |
941 enum Color | |
942 White | |
943 Red | |
944 Green | |
945 Blue | |
946 Black | |
947 endenum | |
948 " END_INDENT | |
34311
5b46a975e48a
runtime(vim): Fix indent after line with literal dict
Christian Brabandt <cb@256bit.org>
parents:
32721
diff
changeset
|
949 |
5b46a975e48a
runtime(vim): Fix indent after line with literal dict
Christian Brabandt <cb@256bit.org>
parents:
32721
diff
changeset
|
950 " START_INDENT |
5b46a975e48a
runtime(vim): Fix indent after line with literal dict
Christian Brabandt <cb@256bit.org>
parents:
32721
diff
changeset
|
951 call prop_type_add('indent_after_literal_dict', #{ foo: 'bar' }) |
5b46a975e48a
runtime(vim): Fix indent after line with literal dict
Christian Brabandt <cb@256bit.org>
parents:
32721
diff
changeset
|
952 call prop_type_delete('indent_after_literal_dict') |
5b46a975e48a
runtime(vim): Fix indent after line with literal dict
Christian Brabandt <cb@256bit.org>
parents:
32721
diff
changeset
|
953 " END_INDENT |