view runtime/indent/tilde.vim @ 32393:ba9862df7d13 v9.0.1528

patch 9.0.1528: libsodium encryption is only used with "huge" features Commit: https://github.com/vim/vim/commit/dda01c05c2ded3f0d11703bd983a19b6ca7d5055 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 8 22:11:07 2023 +0100 patch 9.0.1528: libsodium encryption is only used with "huge" features Problem: Libsodium encryption is only used with "huge" features, even when manually enabled through configure. (Tony Mechelynck) Solution: Remove the condition on FEAT_HUGE.
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 May 2023 23:15:03 +0200
parents 4d76b3e07c07
children
line wrap: on
line source

"Description: Indent scheme for the tilde weblanguage
"Author: Tobias Rundström <tobi@tobi.nu> (Invalid email address)
"URL: http://tilde.tildesoftware.net
"Last Change: May  8 09:15:09 CEST 2002
"	      2022 April: b:undo_indent added by Doug Kearns

if exists ("b:did_indent")
	finish
endif

let b:did_indent = 1

setlocal autoindent
setlocal indentexpr=GetTildeIndent(v:lnum)
setlocal indentkeys=o,O,)

let b:undo_indent = "setl ai< inde< indk<"

if exists("*GetTildeIndent")
	finish
endif

function GetTildeIndent(lnum)
	let plnum = prevnonblank(v:lnum-1)

	if plnum == 0
		return 0
	endif

	if getline(v:lnum) =~ '^\s*\~\(endif\|else\|elseif\|end\)\>'
		return indent(v:lnum) - shiftwidth()
	endif

	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\)\>'
		return indent(plnum) + shiftwidth()
	else
		return -1
	endif
endfunction