mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 20:13:51 -05:00
Update latex-box and elixir
This commit is contained in:
@@ -785,6 +785,41 @@ function! s:GetEnvironmentList(lead, cmdline, pos)
|
|||||||
endfor
|
endfor
|
||||||
return suggestions
|
return suggestions
|
||||||
endfunction
|
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 {{{
|
" 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>LatexEnvWrapSelection :<c-u>call <SID>PromptEnvWrapSelection()<CR>
|
||||||
vnoremap <silent> <Plug>LatexEnvWrapFmtSelection :<c-u>call <SID>PromptEnvWrapSelection(1)<CR>
|
vnoremap <silent> <Plug>LatexEnvWrapFmtSelection :<c-u>call <SID>PromptEnvWrapSelection(1)<CR>
|
||||||
nnoremap <silent> <Plug>LatexChangeEnv :call <SID>ChangeEnvPrompt()<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
|
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4
|
||||||
|
|||||||
@@ -153,13 +153,15 @@ function! LatexBox_FoldLevel(lnum)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
" Never fold \end{document}
|
||||||
|
if line =~# '^\s*\\end{document}'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
" Fold environments
|
" Fold environments
|
||||||
if g:LatexBox_fold_envs == 1
|
if g:LatexBox_fold_envs == 1
|
||||||
if line =~# s:envbeginpattern
|
if line =~# s:envbeginpattern
|
||||||
return "a1"
|
return "a1"
|
||||||
elseif line =~# '^\s*\\end{document}'
|
|
||||||
" Never fold \end{document}
|
|
||||||
return 0
|
|
||||||
elseif line =~# s:envendpattern
|
elseif line =~# s:envendpattern
|
||||||
return "s1"
|
return "s1"
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
if !exists('g:LatexBox_latexmk_options')
|
if !exists('g:LatexBox_latexmk_options')
|
||||||
let g:LatexBox_latexmk_options = ''
|
let g:LatexBox_latexmk_options = ''
|
||||||
endif
|
endif
|
||||||
|
if !exists('g:LatexBox_latexmk_env')
|
||||||
|
let g:LatexBox_latexmk_env = ''
|
||||||
|
endif
|
||||||
if !exists('g:LatexBox_latexmk_async')
|
if !exists('g:LatexBox_latexmk_async')
|
||||||
let g:LatexBox_latexmk_async = 0
|
let g:LatexBox_latexmk_async = 0
|
||||||
endif
|
endif
|
||||||
@@ -156,6 +159,9 @@ function! LatexBox_Latexmk(force)
|
|||||||
let env = 'max_print_line=' . max_print_line
|
let env = 'max_print_line=' . max_print_line
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Set environment options
|
||||||
|
let env .= ' ' . g:LatexBox_latexmk_env . ' '
|
||||||
|
|
||||||
" Set latexmk command with options
|
" Set latexmk command with options
|
||||||
if has('win32')
|
if has('win32')
|
||||||
" Make sure to switch drive as well as directory
|
" Make sure to switch drive as well as directory
|
||||||
|
|||||||
@@ -39,8 +39,15 @@ function! GetElixirIndent(...)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if synIDattr(synID(v:lnum, 1, 1), "name") !~ '\(Comment\|String\)$'
|
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 .
|
if getline(lnum) =~ s:indent_keywords .
|
||||||
\ '\|^\s*\%(^.*[\[{(].*[,:]\|.*->\)$'
|
\ '\|^\s*\%(.*->\)$'
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user