Fix #560: More compact include tags

This commit is contained in:
Karl Yngve Lervåg 2016-10-20 22:47:12 +02:00
parent 6e27700de5
commit d457431284

View File

@ -152,8 +152,8 @@ function! vimtex#toc#get_entries() " {{{1
if index(l:included.files, l:file) < 0 if index(l:included.files, l:file) < 0
let l:included.files += [l:file] let l:included.files += [l:file]
let l:included.current = { let l:included.current = {
\ 'title' : 'Included: ' . fnamemodify(l:file, ':t'), \ 'title' : fnamemodify(l:file, ':t'),
\ 'number' : '', \ 'number' : '[i]',
\ 'file' : l:file, \ 'file' : l:file,
\ 'line' : 1, \ 'line' : 1,
\ 'level' : s:number.current_level, \ 'level' : s:number.current_level,
@ -173,11 +173,10 @@ function! vimtex#toc#get_entries() " {{{1
endif endif
let l:fname = fnamemodify(l:fname, ':~:.') let l:fname = fnamemodify(l:fname, ':~:.')
call add(l:toc, { call add(l:toc, {
\ 'title' : 'Vimtex include: ' \ 'title' : (strlen(l:fname) < 70
\ . (strlen(l:fname) < 54
\ ? l:fname \ ? l:fname
\ : l:fname[0:20] . '...' . l:fname[-30:]), \ : l:fname[0:30] . '...' . l:fname[-36:]),
\ 'number' : '', \ 'number' : '[v]',
\ 'file' : l:fname, \ 'file' : l:fname,
\ 'level' : s:number.current_level, \ 'level' : s:number.current_level,
\ 'link' : 1, \ 'link' : 1,
@ -332,6 +331,7 @@ endfunction
" }}}1 " }}}1
function! s:index_print_number(number) dict " {{{1 function! s:index_print_number(number) dict " {{{1
if empty(a:number) | return '' | endif if empty(a:number) | return '' | endif
if type(a:number) == type('') | return a:number | endif
let number = [ let number = [
\ a:number.part, \ a:number.part,
@ -378,11 +378,13 @@ function! s:index_syntax() dict "{{{1
syntax match VimtexTocHelp /^\S.*: .*/ syntax match VimtexTocHelp /^\S.*: .*/
syntax match VimtexTocNum syntax match VimtexTocNum
\ /^\(\([A-Z]\+\>\|\d\+\)\(\.\d\+\)*\)\?\s*/ contained \ /^\(\([A-Z]\+\>\|\d\+\)\(\.\d\+\)*\)\?\s*/ contained
syntax match VimtexTocSec0 /^.*0$/ contains=VimtexTocNum,@Tex syntax match VimtexTocTag
syntax match VimtexTocSec1 /^.*1$/ contains=VimtexTocNum,@Tex \ /^\[.\]/ contained
syntax match VimtexTocSec2 /^.*2$/ contains=VimtexTocNum,@Tex syntax match VimtexTocSec0 /^.*0$/ contains=VimtexTocNum,VimtexTocTag,@Tex
syntax match VimtexTocSec3 /^.*3$/ contains=VimtexTocNum,@Tex syntax match VimtexTocSec1 /^.*1$/ contains=VimtexTocNum,VimtexTocTag,@Tex
syntax match VimtexTocSec4 /^.*4$/ contains=VimtexTocNum,@Tex syntax match VimtexTocSec2 /^.*2$/ contains=VimtexTocNum,VimtexTocTag,@Tex
syntax match VimtexTocSec3 /^.*3$/ contains=VimtexTocNum,VimtexTocTag,@Tex
syntax match VimtexTocSec4 /^.*4$/ contains=VimtexTocNum,VimtexTocTag,@Tex
endfunction endfunction
" }}}1 " }}}1
@ -442,8 +444,8 @@ function! s:parse_bib_input(line) " {{{1
endif endif
return { return {
\ 'title' : printf('Included bib file: %-.60s', fnamemodify(l:file, ':t')), \ 'title' : printf('%-.78s', fnamemodify(l:file, ':t')),
\ 'number' : '', \ 'number' : '[b]',
\ 'file' : vimtex#util#kpsewhich(l:file), \ 'file' : vimtex#util#kpsewhich(l:file),
\ 'line' : 0, \ 'line' : 0,
\ 'level' : s:max_level, \ 'level' : s:max_level,
@ -615,6 +617,7 @@ let s:re_bibs .= '\m\s*{\zs[^}]\+\ze}'
" Define highlight groups " Define highlight groups
call vimtex#util#set_highlight('VimtexTocNum', 'Number') call vimtex#util#set_highlight('VimtexTocNum', 'Number')
call vimtex#util#set_highlight('VimtexTocTag', 'Directory')
call vimtex#util#set_highlight('VimtexTocSec0', 'Title') call vimtex#util#set_highlight('VimtexTocSec0', 'Title')
call vimtex#util#set_highlight('VimtexTocSec1', 'Normal') call vimtex#util#set_highlight('VimtexTocSec1', 'Normal')
call vimtex#util#set_highlight('VimtexTocSec2', 'helpVim') call vimtex#util#set_highlight('VimtexTocSec2', 'helpVim')