diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-18 22:51:23 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-18 22:51:23 +0200 | 
| commit | 235a5631f96ca7613d0fe48fe3731a8ce76e436d (patch) | |
| tree | 58fe585102a5dd1ed5b8b9efc202c6a880cafaa0 /ftplugin/latex-box/complete.vim | |
| parent | edf1aa4a1cc7993b33352870e099d1298d14f67f (diff) | |
| download | vim-polyglot-235a5631f96ca7613d0fe48fe3731a8ce76e436d.tar.gz vim-polyglot-235a5631f96ca7613d0fe48fe3731a8ce76e436d.zip | |
Update latex-box and elixir
Diffstat (limited to 'ftplugin/latex-box/complete.vim')
| -rw-r--r-- | ftplugin/latex-box/complete.vim | 36 | 
1 files changed, 36 insertions, 0 deletions
| diff --git a/ftplugin/latex-box/complete.vim b/ftplugin/latex-box/complete.vim index 76f909b9..1a1389af 100644 --- a/ftplugin/latex-box/complete.vim +++ b/ftplugin/latex-box/complete.vim @@ -785,6 +785,41 @@ function! s:GetEnvironmentList(lead, cmdline, pos)  	endfor  	return suggestions  endfunction + +function! s:LatexToggleStarEnv() +	let [env, lnum, cnum, lnum2, cnum2] = LatexBox_GetCurrentEnvironment(1) + +	if env == '\(' +		return +	elseif env == '\[' +		let begin = '\begin{equation}' +		let end = '\end{equation}' +	elseif env[-1:] == '*' +		let begin = '\begin{' . env[:-2] . '}' +		let end   = '\end{'   . env[:-2] . '}' +	else +		let begin = '\begin{' . env . '*}' +		let end   = '\end{'   . env . '*}' +	endif + +	if env == '\[' +		let line = getline(lnum2) +		let line = strpart(line, 0, cnum2 - 1) . l:end . strpart(line, cnum2 + 1) +		call setline(lnum2, line) + +		let line = getline(lnum) +		let line = strpart(line, 0, cnum - 1) . l:begin . strpart(line, cnum + 1) +		call setline(lnum, line) +	else +		let line = getline(lnum2) +		let line = strpart(line, 0, cnum2 - 1) . l:end . strpart(line, cnum2 + len(env) + 5) +		call setline(lnum2, line) + +		let line = getline(lnum) +		let line = strpart(line, 0, cnum - 1) . l:begin . strpart(line, cnum + len(env) + 7) +		call setline(lnum, line) +	endif +endfunction  " }}}  " Next Charaters Match {{{ @@ -800,6 +835,7 @@ vnoremap <silent> <Plug>LatexWrapSelection			:<c-u>call <SID>WrapSelection('')<C  vnoremap <silent> <Plug>LatexEnvWrapSelection		:<c-u>call <SID>PromptEnvWrapSelection()<CR>  vnoremap <silent> <Plug>LatexEnvWrapFmtSelection	:<c-u>call <SID>PromptEnvWrapSelection(1)<CR>  nnoremap <silent> <Plug>LatexChangeEnv				:call <SID>ChangeEnvPrompt()<CR> +nnoremap <silent> <Plug>LatexToggleStarEnv			:call <SID>LatexToggleStarEnv()<CR>  " }}}  " vim:fdm=marker:ff=unix:noet:ts=4:sw=4 | 
