annotate runtime/indent/tilde.vim @ 7052:9ec3329823f9 v7.4.838

commit https://github.com/vim/vim/commit/8060687905bdadc46abb68ee6d40e5660e352297 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 25 21:27:35 2015 +0200 patch 7.4.838 Problem: Can't compile without the crypt feature. (John Marriott) Solution: Add #ifdef.
author Christian Brabandt <cb@256bit.org>
date Tue, 25 Aug 2015 21:30:04 +0200
parents 3fc0f57ecb91
children 63b0b7b79b25
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 "Author: Tobias Rundström <tobi@tobi.nu>
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\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 return indent(v:lnum) - &sw
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\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 return indent(plnum) + &sw
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