annotate runtime/indent/tilde.vim @ 26404:1bbb884c8561 v8.2.3733

patch 8.2.3733: Vim9: using "legacy" before range does not work Commit: https://github.com/vim/vim/commit/b579f6ebbfa826d228abec1e1b24c05894517c27 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 4 11:57:00 2021 +0000 patch 8.2.3733: Vim9: using "legacy" before range does not work Problem: Vim9: using "legacy" before range does not work. Solution: Skip over range before parsing command. (closes https://github.com/vim/vim/issues/9270)
author Bram Moolenaar <Bram@vim.org>
date Sat, 04 Dec 2021 13:00:05 +0100
parents 5b7ea82bc18f
children 4d76b3e07c07
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 "Description: Indent scheme for the tilde weblanguage
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
2 "Author: Tobias Rundström <tobi@tobi.nu>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 "URL: http://tilde.tildesoftware.net
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 "Last Change: May 8 09:15:09 CEST 2002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 if exists ("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 setlocal autoindent
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 setlocal indentexpr=GetTildeIndent(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 setlocal indentkeys=o,O,)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 if exists("*GetTildeIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 function GetTildeIndent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 let plnum = prevnonblank(v:lnum-1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 if plnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 if getline(v:lnum) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
28 return indent(v:lnum) - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 if getline(plnum) =~ '^\s*\~\(if\|foreach\|foreach_row\|xml_loop\|file_loop\|file_write\|file_append\|imap_loopsections\|imap_index\|imap_list\|ldap_search\|post_loopall\|post_loop\|file_loop\|sql_loop_num\|sql_dbmsselect\|search\|sql_loop\|post\|for\|function_define\|silent\|while\|setvalbig\|mail_create\|systempipe\|mail_send\|dual\|elseif\|else\)\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
32 return indent(plnum) + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 return -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 endfunction