diff options
-rw-r--r-- | ftplugin/latex-box/complete.vim | 36 | ||||
-rw-r--r-- | ftplugin/latex-box/folding.vim | 8 | ||||
-rw-r--r-- | ftplugin/latex-box/latexmk.vim | 6 | ||||
-rw-r--r-- | indent/elixir.vim | 9 |
4 files changed, 55 insertions, 4 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 diff --git a/ftplugin/latex-box/folding.vim b/ftplugin/latex-box/folding.vim index 36f1577b..55a975f8 100644 --- a/ftplugin/latex-box/folding.vim +++ b/ftplugin/latex-box/folding.vim @@ -153,13 +153,15 @@ function! LatexBox_FoldLevel(lnum) endif endfor + " Never fold \end{document} + if line =~# '^\s*\\end{document}' + return 0 + endif + " Fold environments if g:LatexBox_fold_envs == 1 if line =~# s:envbeginpattern return "a1" - elseif line =~# '^\s*\\end{document}' - " Never fold \end{document} - return 0 elseif line =~# s:envendpattern return "s1" endif diff --git a/ftplugin/latex-box/latexmk.vim b/ftplugin/latex-box/latexmk.vim index 4ea3ff09..0049146a 100644 --- a/ftplugin/latex-box/latexmk.vim +++ b/ftplugin/latex-box/latexmk.vim @@ -5,6 +5,9 @@ if !exists('g:LatexBox_latexmk_options') let g:LatexBox_latexmk_options = '' endif +if !exists('g:LatexBox_latexmk_env') + let g:LatexBox_latexmk_env = '' +endif if !exists('g:LatexBox_latexmk_async') let g:LatexBox_latexmk_async = 0 endif @@ -156,6 +159,9 @@ function! LatexBox_Latexmk(force) let env = 'max_print_line=' . max_print_line endif + " Set environment options + let env .= ' ' . g:LatexBox_latexmk_env . ' ' + " Set latexmk command with options if has('win32') " Make sure to switch drive as well as directory diff --git a/indent/elixir.vim b/indent/elixir.vim index 54bc8289..e4798141 100644 --- a/indent/elixir.vim +++ b/indent/elixir.vim @@ -39,8 +39,15 @@ function! GetElixirIndent(...) endif if synIDattr(synID(v:lnum, 1, 1), "name") !~ '\(Comment\|String\)$' + let splited_line = split(getline(lnum), '\zs') + let opened_symbol = 0 + let opened_symbol += count(splited_line, '[') - count(splited_line, ']') + let opened_symbol += count(splited_line, '{') - count(splited_line, '}') + + let ind += opened_symbol * &sw + if getline(lnum) =~ s:indent_keywords . - \ '\|^\s*\%(^.*[\[{(].*[,:]\|.*->\)$' + \ '\|^\s*\%(.*->\)$' let ind += &sw endif |