robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
521e91e1c4
master
1"Description: Indent scheme for the tilde weblanguage 2"Author: Tobias Rundström <tobi@tobi.nu> (Invalid email address) 3"URL: http://tilde.tildesoftware.net 4"Last Change: May 8 09:15:09 CEST 2002 5" 2022 April: b:undo_indent added by Doug Kearns 6 7if exists ( "b:did_indent" ) 8finish 9endif 10 11let b: did_indent = 1 12 13setlocal autoindent 14setlocal indentexpr = GetTildeIndent (v:lnum) 15setlocal indentkeys = o,O,) 16 17let b: undo_indent = "setl ai< inde< indk<" 18 19if exists ( "*GetTildeIndent" ) 20finish 21endif 22 23function GetTildeIndent ( lnum ) 24let plnum = prevnonblank ( v: lnum - 1 ) 25 26if plnum == 0 27return 0 28endif 29 30if getline ( v: lnum ) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>' 31return indent ( v: lnum ) - shiftwidth () 32endif 33 34if 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\)\>' 35return indent ( plnum ) + shiftwidth () 36else 37return -1 38endif 39endfunction