annotate runtime/indent/lua.vim @ 33276:05c320c640de v9.0.1905

patch 9.0.1905: FEAT_FLOAT no longer defined Commit: https://github.com/vim/vim/commit/0483e49f90d85f5172f2050426913ac718f1c176 Author: dundargoc <gocdundar@gmail.com> Date: Sun Sep 17 16:58:22 2023 +0200 patch 9.0.1905: FEAT_FLOAT no longer defined Problem: FEAT_FLOAT no longer defined Solution: Remove last existing FEAT_FLOAT ifdefs in message_test Remove FEAT_FLOAT as that should always be true FEAT_FLOAT has been removed in v9.0.0491 (73e28dcc6125f616cf1f2) but unfortunately, it was forgotten to remove it from message_test.c. So let's remove the last mentioned ifdefs which are now unused. closes: #13106 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: dundargoc <gocdundar@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Sep 2023 17:15:04 +0200
parents 995bbd5ddec6
children 6f6e7c2de606
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Lua script
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
3 " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br>
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
4 " First Author: Max Ischenko <mfi 'at' ukr.net>
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 7557
diff changeset
5 " Last Change: 2017 Jun 13
30324
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
6 " 2022 Sep 07: b:undo_indent added by Doug Kearns
323
03b3684919e3 updated for version 7.0084
vimboss
parents: 22
diff changeset
7
03b3684919e3 updated for version 7.0084
vimboss
parents: 22
diff changeset
8 " Only load this indent file when no other was loaded.
03b3684919e3 updated for version 7.0084
vimboss
parents: 22
diff changeset
9 if exists("b:did_indent")
03b3684919e3 updated for version 7.0084
vimboss
parents: 22
diff changeset
10 finish
03b3684919e3 updated for version 7.0084
vimboss
parents: 22
diff changeset
11 endif
03b3684919e3 updated for version 7.0084
vimboss
parents: 22
diff changeset
12 let b:did_indent = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
14 setlocal indentexpr=GetLuaIndent()
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
15
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
16 " To make Vim call GetLuaIndent() when it finds '\s*end' or '\s*until'
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
17 " on the current line ('else' is default and includes 'elseif').
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
18 setlocal indentkeys+=0=end,0=until
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
19
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
20 setlocal autoindent
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
21
30324
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
22 let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<"
0827d3d6d8c0 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
23
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 " Only define the function once.
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
25 if exists("*GetLuaIndent")
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
26 finish
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
27 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 function! GetLuaIndent()
32939
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
30 let ignorecase_save = &ignorecase
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
31 try
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
32 let &ignorecase = 0
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
33 return GetLuaIndentIntern()
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
34 finally
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
35 let &ignorecase = ignorecase_save
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
36 endtry
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
37 endfunction
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
38
995bbd5ddec6 runtime(lua): fix lua indentation of non-lowercase "keywords" (#11759)
Christian Brabandt <cb@256bit.org>
parents: 32933
diff changeset
39 function! GetLuaIndentIntern()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " Find a non-blank line above the current line.
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
41 let prevlnum = prevnonblank(v:lnum - 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " Hit the start of the file, use zero indent.
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
44 if prevlnum == 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
359
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
48 " Add a 'shiftwidth' after lines that start a block:
6c62b9b939bd updated for version 7.0093
vimboss
parents: 323
diff changeset
49 " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{'
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
50 let ind = indent(prevlnum)
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
51 let prevline = getline(prevlnum)
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
52 let midx = match(prevline, '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)')
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
53 if midx == -1
32933
f7576cf3640f runtime(lua): indent curly bracket followed by line comment (#12306)
Christian Brabandt <cb@256bit.org>
parents: 30324
diff changeset
54 let midx = match(prevline, '{\s*\%(--\%([^[].*\)\?\)\?$')
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
55 if midx == -1
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
56 let midx = match(prevline, '\<function\>\s*\%(\k\|[.:]\)\{-}\s*(')
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
57 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
60 if midx != -1
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
61 " Add 'shiftwidth' if what we found previously is not in a comment and
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
62 " an "end" or "until" is not present on the same line.
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
63 if synIDattr(synID(prevlnum, midx + 1, 1), "name") != "luaComment" && prevline !~ '\<end\>\|\<until\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 7557
diff changeset
64 let ind = ind + shiftwidth()
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
65 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
7557
502ca0a62fd8 commit https://github.com/vim/vim/commit/acb4f221c715a333f4c49a2235a8006c6ac6e4d5
Christian Brabandt <cb@256bit.org>
parents: 6369
diff changeset
68 " Subtract a 'shiftwidth' on end, else, elseif, until and '}'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " This is the part that requires 'indentkeys'.
7557
502ca0a62fd8 commit https://github.com/vim/vim/commit/acb4f221c715a333f4c49a2235a8006c6ac6e4d5
Christian Brabandt <cb@256bit.org>
parents: 6369
diff changeset
70 let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)')
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 359
diff changeset
71 if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment"
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 7557
diff changeset
72 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 endfunction