Skip to content

Commit

Permalink
feat: preserve main root for local standalones
Browse files Browse the repository at this point in the history
refer: #2234
  • Loading branch information
lervag committed Nov 9, 2021
1 parent b99246d commit 533f6e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion autoload/vimtex/state.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function! vimtex#state#init_local() abort " {{{1
if l:vimtex_id < 0
let l:vimtex_id = s:vimtex_next_id
let l:vimtex = vimtex#state#class#new(
\ l:filename, 'local file', l:preserve_root)
\ l:filename, 'local file',
\ l:preserve_root || s:check_standalone())
let s:vimtex_next_id += 1
let s:vimtex_states[l:vimtex_id] = l:vimtex

Expand Down Expand Up @@ -534,6 +535,13 @@ endfunction

" }}}1

function! s:check_standalone() abort " {{{1
return match(getline(1, 5),
\ '\v^\C\s*\\documentclass%(\[.*\])?\{standalone\}') >= 0
endfunction

" }}}1


" Initialize module
let s:vimtex_states = {}
Expand Down

0 comments on commit 533f6e7

Please sign in to comment.