From 0cefdc304e81b24b9e321240fb4ada11c5346846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Thu, 20 Oct 2016 21:01:33 +0200 Subject: [PATCH] Fixed #541: Add b:vimtex.sources This allows the desired type of customization. --- autoload/vimtex.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/autoload/vimtex.vim b/autoload/vimtex.vim index bf7ff4e..435a866 100644 --- a/autoload/vimtex.vim +++ b/autoload/vimtex.vim @@ -66,6 +66,11 @@ function! vimtex#init() " {{{1 " call s:init_local_blob() + " + " Parse the document to set local options + " + call s:init_local_options() + " " Finally we create the mappings " @@ -468,6 +473,20 @@ function! s:init_local_blob() " {{{1 endif endfunction +" }}}1 +function! s:init_local_options() " {{{1 + let b:vimtex.sources = [] + + for [l:file, l:lnum, l:line] in vimtex#parser#tex(b:vimtex.tex) + let l:cand = substitute(l:file, '\M' . b:vimtex.root, '', '') + if l:cand[0] ==# '/' | let l:cand = l:cand[1:] | endif + + if index(b:vimtex.sources, l:cand) < 0 + call add(b:vimtex.sources, l:cand) + endif + endfor +endfunction + " }}}1 function! s:get_id(main) " {{{1