Mercurial > vim
annotate runtime/indent/idlang.vim @ 34618:7ff3c277377f v9.1.0198
patch 9.1.0198: Vim9: compound operators broken for lambdas in an object
Commit: https://github.com/vim/vim/commit/d990bf08d85d83e14fc51fd99a66ebe2f36d2fcd
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Fri Mar 22 19:56:17 2024 +0100
patch 9.1.0198: Vim9: compound operators broken for lambdas in an object
Problem: Vim9: compound operators broken for lambdas in an object
(girishji)
Solution: When using an object from the outer scope, use the LOADOUTER
instruction to load the object (Yegappan Lakshmanan).
fixes: #14236
closes: #14266
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 22 Mar 2024 20:00:06 +0100 |
parents | 6dd88e45d47d |
children |
rev | line source |
---|---|
7 | 1 " IDL (Interactive Data Language) indent file. |
25880 | 2 " Language: IDL (ft=idlang) |
3 " Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com> (Invalid email address) | |
4 " Doug Kearns <dougkearns@gmail.com> | |
28379 | 5 " Last change: 2022 Apr 06 |
7 | 6 |
7 " Only load this indent file when no other was loaded. | |
8 if exists("b:did_indent") | |
9 finish | |
10 endif | |
11 let b:did_indent = 1 | |
12 | |
3526
dd6c2497c997
Fix more 'cpo' issues in runtime files.
Bram Moolenaar <bram@vim.org>
parents:
7
diff
changeset
|
13 setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,0=ENDWHILE,0=endfor,0=ENDFOR,0=endrep,0=ENDREP |
7 | 14 |
15 setlocal indentexpr=GetIdlangIndent(v:lnum) | |
16 | |
28379 | 17 let b:undo_indent = "setl inde< indk<" |
18 | |
7 | 19 " Only define the function once. |
20 if exists("*GetIdlangIndent") | |
21 finish | |
22 endif | |
23 | |
24 function GetIdlangIndent(lnum) | |
25 " First non-empty line above the current line. | |
26 let pnum = prevnonblank(v:lnum-1) | |
27 " v:lnum is the first non-empty line -- zero indent. | |
28 if pnum == 0 | |
29 return 0 | |
30 endif | |
31 " Second non-empty line above the current line. | |
32 let pnum2 = prevnonblank(pnum-1) | |
33 | |
34 " Current indent. | |
35 let curind = indent(pnum) | |
36 | |
37 " Indenting of continued lines. | |
38 if getline(pnum) =~ '\$\s*\(;.*\)\=$' | |
39 if getline(pnum2) !~ '\$\s*\(;.*\)\=$' | |
11518 | 40 let curind = curind+shiftwidth() |
7 | 41 endif |
42 else | |
43 if getline(pnum2) =~ '\$\s*\(;.*\)\=$' | |
11518 | 44 let curind = curind-shiftwidth() |
7 | 45 endif |
46 endif | |
47 | |
48 " Indenting blocks of statements. | |
49 if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>' | |
50 if getline(pnum) =~? 'begin\>' | |
11518 | 51 elseif indent(v:lnum) > curind-shiftwidth() |
52 let curind = curind-shiftwidth() | |
7 | 53 else |
54 return -1 | |
55 endif | |
56 elseif getline(pnum) =~? 'begin\>' | |
11518 | 57 if indent(v:lnum) < curind+shiftwidth() |
58 let curind = curind+shiftwidth() | |
7 | 59 else |
60 return -1 | |
61 endif | |
62 endif | |
63 return curind | |
64 endfunction | |
65 |