Mercurial > vim
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 |
rev | line source |
---|---|
7 | 1 " Vim indent file |
2 " Language: Lua script | |
22 | 3 " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br> |
4 " First Author: Max Ischenko <mfi 'at' ukr.net> | |
11518 | 5 " Last Change: 2017 Jun 13 |
30324 | 6 " 2022 Sep 07: b:undo_indent added by Doug Kearns |
323 | 7 |
8 " Only load this indent file when no other was loaded. | |
9 if exists("b:did_indent") | |
10 finish | |
11 endif | |
12 let b:did_indent = 1 | |
7 | 13 |
359 | 14 setlocal indentexpr=GetLuaIndent() |
15 | |
16 " To make Vim call GetLuaIndent() when it finds '\s*end' or '\s*until' | |
17 " on the current line ('else' is default and includes 'elseif'). | |
18 setlocal indentkeys+=0=end,0=until | |
19 | |
20 setlocal autoindent | |
21 | |
30324 | 22 let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<" |
23 | |
7 | 24 " Only define the function once. |
22 | 25 if exists("*GetLuaIndent") |
26 finish | |
27 endif | |
7 | 28 |
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 | 40 " Find a non-blank line above the current line. |
1620 | 41 let prevlnum = prevnonblank(v:lnum - 1) |
7 | 42 |
43 " Hit the start of the file, use zero indent. | |
1620 | 44 if prevlnum == 0 |
7 | 45 return 0 |
46 endif | |
47 | |
359 | 48 " Add a 'shiftwidth' after lines that start a block: |
49 " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{' | |
1620 | 50 let ind = indent(prevlnum) |
51 let prevline = getline(prevlnum) | |
52 let midx = match(prevline, '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)') | |
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 | 55 if midx == -1 |
56 let midx = match(prevline, '\<function\>\s*\%(\k\|[.:]\)\{-}\s*(') | |
57 endif | |
7 | 58 endif |
59 | |
1620 | 60 if midx != -1 |
61 " Add 'shiftwidth' if what we found previously is not in a comment and | |
62 " an "end" or "until" is not present on the same line. | |
63 if synIDattr(synID(prevlnum, midx + 1, 1), "name") != "luaComment" && prevline !~ '\<end\>\|\<until\>' | |
11518 | 64 let ind = ind + shiftwidth() |
1620 | 65 endif |
7 | 66 endif |
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 | 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 | 71 if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment" |
11518 | 72 let ind = ind - shiftwidth() |
7 | 73 endif |
74 | |
75 return ind | |
76 endfunction |