Don't hide help functions
This commit is contained in:
parent
7b35d3782b
commit
875793e74e
@ -131,20 +131,42 @@ endfunction
|
|||||||
"
|
"
|
||||||
let s:re_delims = vimtex#delim#get_delim_regexes()
|
let s:re_delims = vimtex#delim#get_delim_regexes()
|
||||||
|
|
||||||
function! s:count(line, pattern) " {{{2
|
" }}}1
|
||||||
let l:sum = 0
|
function! s:indent_tikz(lnum, prev) " {{{1
|
||||||
let l:indx = match(a:line, a:pattern)
|
if vimtex#env#is_inside('tikzpicture')
|
||||||
while l:indx >= 0
|
let l:prev_starts = a:prev =~# s:tikz_commands
|
||||||
let l:sum += 1
|
let l:prev_stops = a:prev =~# ';\s*$'
|
||||||
let l:match = matchstr(a:line, a:pattern, l:indx)
|
|
||||||
let l:indx += len(l:match)
|
" Increase indent on tikz command start
|
||||||
let l:indx = match(a:line, a:pattern, l:indx)
|
if l:prev_starts && ! l:prev_stops
|
||||||
endwhile
|
return &sw
|
||||||
return l:sum
|
endif
|
||||||
|
|
||||||
|
" Decrease indent on tikz command end, i.e. on semicolon
|
||||||
|
if ! l:prev_starts && l:prev_stops
|
||||||
|
let l:context = join(getline(max([1,a:lnum-4]), a:lnum-1), '')
|
||||||
|
return -&sw*(l:context =~# s:tikz_commands)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}2
|
let s:tikz_commands = '\v\\%(' . join([
|
||||||
function! s:split(line, lnum, ...) " {{{2
|
\ 'draw',
|
||||||
|
\ 'fill',
|
||||||
|
\ 'path',
|
||||||
|
\ 'node',
|
||||||
|
\ 'coordinate',
|
||||||
|
\ 'add%(legendentry|plot)',
|
||||||
|
\ ], '|') . ')'
|
||||||
|
|
||||||
|
" }}}1
|
||||||
|
|
||||||
|
"
|
||||||
|
" Utility functions for s:indent_delims
|
||||||
|
"
|
||||||
|
function! s:split(line, lnum, ...) " {{{1
|
||||||
let l:map = s:map_math(a:lnum, strlen(a:line))
|
let l:map = s:map_math(a:lnum, strlen(a:line))
|
||||||
|
|
||||||
" Extract normal text
|
" Extract normal text
|
||||||
@ -178,12 +200,11 @@ function! s:split(line, lnum, ...) " {{{2
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
echom l:normal string(l:map)
|
|
||||||
return [l:normal, l:math]
|
return [l:normal, l:math]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}2
|
" }}}1
|
||||||
function! s:map_math(lnum, len) " {{{2
|
function! s:map_math(lnum, len) " {{{1
|
||||||
call setpos('.', [0, a:lnum, 1, 0])
|
call setpos('.', [0, a:lnum, 1, 0])
|
||||||
let l:in_math = vimtex#util#in_mathzone()
|
let l:in_math = vimtex#util#in_mathzone()
|
||||||
let l:result = [[0, l:in_math]]
|
let l:result = [[0, l:in_math]]
|
||||||
@ -222,38 +243,19 @@ function! s:map_math(lnum, len) " {{{2
|
|||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}2
|
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
function! s:indent_tikz(lnum, prev) " {{{1
|
function! s:count(line, pattern) " {{{1
|
||||||
if vimtex#env#is_inside('tikzpicture')
|
let l:sum = 0
|
||||||
let l:prev_starts = a:prev =~# s:tikz_commands
|
let l:indx = match(a:line, a:pattern)
|
||||||
let l:prev_stops = a:prev =~# ';\s*$'
|
while l:indx >= 0
|
||||||
|
let l:sum += 1
|
||||||
" Increase indent on tikz command start
|
let l:match = matchstr(a:line, a:pattern, l:indx)
|
||||||
if l:prev_starts && ! l:prev_stops
|
let l:indx += len(l:match)
|
||||||
return &sw
|
let l:indx = match(a:line, a:pattern, l:indx)
|
||||||
endif
|
endwhile
|
||||||
|
return l:sum
|
||||||
" Decrease indent on tikz command end, i.e. on semicolon
|
|
||||||
if ! l:prev_starts && l:prev_stops
|
|
||||||
let l:context = join(getline(max([1,a:lnum-4]), a:lnum-1), '')
|
|
||||||
return -&sw*(l:context =~# s:tikz_commands)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:tikz_commands = '\v\\%(' . join([
|
|
||||||
\ 'draw',
|
|
||||||
\ 'fill',
|
|
||||||
\ 'path',
|
|
||||||
\ 'node',
|
|
||||||
\ 'coordinate',
|
|
||||||
\ 'add%(legendentry|plot)',
|
|
||||||
\ ], '|') . ')'
|
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
Loading…
Reference in New Issue
Block a user