Add buffer var for main file (fixes #155)

This commit is contained in:
Karl Yngve Lervåg 2015-04-26 09:02:28 +02:00
parent 710c6f3d7a
commit 3f62338895
2 changed files with 14 additions and 0 deletions

View File

@ -168,6 +168,13 @@ function! s:get_id(main) " {{{1
endfunction
function! s:get_main() " {{{1
"
" Use buffer variable if it exists
"
if exists('b:vimtex_main') && filereadable(b:vimtex_main)
return fnamemodify(b:vimtex_main, ':p')
endif
"
" Search for main file specifier at the beginning of file. This is similar
" to the method used by several other plugins and editors, such as vim with

View File

@ -150,6 +150,13 @@ first five lines of the current file similar to this: >
%! TEX root = my-main.tex
< *b:vimtex_main*
Finally, the main file may be specified through the buffer variable
`b:vimtex_main`. If one uses project specific |vimrc| files, one may then use
an |autocmd| to specify the main file through this buffer variable with >
autocmd FileType tex let b:vimtex_main = 'main.tex'
------------------------------------------------------------------------------
Comment on internal tex plugin~
*vimtex-comment-internal*