Compare commits

..

No commits in common. "issue-643/feature/improve-indent-speed" and "master" have entirely different histories.

4 changed files with 2 additions and 1173 deletions

View File

@ -15,7 +15,6 @@ if !g:vimtex_indent_enabled | finish | endif
call vimtex#util#set_default('g:vimtex_indent_ignored_envs', [
\ 'document',
\])
call vimtex#util#set_default('g:vimtex_indent_delims_type', 'simple')
let s:cpo_save = &cpoptions
set cpoptions&vim
@ -57,8 +56,7 @@ function! VimtexIndent(lnum) " {{{1
" Indent environments, delimiters, and tikz
let l:ind = indent(l:prev_lnum)
let l:ind += s:indent_envs(l:line, l:prev_line)
let l:ind += s:indent_delims_{g:vimtex_indent_delims_type}(
\ l:line, a:lnum, l:prev_line, l:prev_lnum)
let l:ind += s:indent_delims(l:line, a:lnum, l:prev_line, l:prev_lnum)
let l:ind += s:indent_tikz(l:prev_lnum, l:prev_line)
return l:ind
endfunction
@ -112,48 +110,7 @@ let s:envs_begitem = s:envs_item . '\|' . s:envs_beglist
let s:envs_enditem = s:envs_item . '\|' . s:envs_endlist
" }}}1
function! s:indent_delims_simple(line, lnum, prev_line, prev_lnum) " {{{1
if empty(s:re_delims) | return 0 | endif
return &sw*( max([ s:count(a:prev_line, s:re_open)
\ - s:count(a:prev_line, s:re_close), 0])
\ - max([ s:count(a:line, s:re_close)
\ - s:count(a:line, s:re_open), 0]))
endfunction
let s:delims_open = [
\ '\(',
\ '\[',
\ '\\\{',
\ '\\langle',
\ '\\lvert',
\ '\\lfloor',
\ '\\lceil',
\ '\\ulcorner',
\]
let s:delims_close = [
\ '\)',
\ '\]',
\ '\\\}',
\ '\\rangle',
\ '\\rvert',
\ '\\rfloor',
\ '\\rceil',
\ '\\urcorner',
\]
let s:re_open = '\v'
\ . '%(\\left|\\[bB]igg?l?)\s*%(' . join(s:delims_open, '|') . ')'
\ . '|\\left\s*\.'
\ . '|\{'
\ . '|\\\['
let s:re_close = '\v'
\ . '%(\\right|\\[bB]igg?r?)\s*%(' . join(s:delims_close, '|') . ')'
\ . '|\\right\s*\.'
\ . '|\}'
\ . '|\\\]'
" }}}1
function! s:indent_delims_complex(line, lnum, prev_line, prev_lnum) " {{{1
function! s:indent_delims(line, lnum, prev_line, prev_lnum) " {{{1
if empty(s:re_delims) | return 0 | endif
let l:pre = s:split(a:prev_line, a:prev_lnum)
@ -175,8 +132,6 @@ endfunction
" s:re_delims[1] == math close
" s:re_delims[2] == text open
" s:re_delims[3] == text close
" s:re_delims[4] == math open only with modifier
" s:re_delims[5] == math close only with modifier
"
let s:re_delims = vimtex#delim#get_delim_regexes()

View File

@ -1 +0,0 @@
time vim -Nu test.vim

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
set nocompatible
let &rtp = '~/.vim/bundle/vimtex,' . &rtp
let &rtp .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
" let g:vimtex_indent_delims_type = 'complex'
silent edit test.tex
profile start test.log
profile func *
profile file *
silent! normal! gg=G
profile pause
quit!