Accept proposal to respect CWD (fixes #155)
This commit is contained in:
parent
e74fc287ed
commit
68b9ce1237
@ -189,15 +189,21 @@ function! s:get_main() " {{{1
|
|||||||
\ '^\C\s*\\documentclass\[\zs.*\ze\]{subfiles}',
|
\ '^\C\s*\\documentclass\[\zs.*\ze\]{subfiles}',
|
||||||
\ ]
|
\ ]
|
||||||
for line in getline(1, 5)
|
for line in getline(1, 5)
|
||||||
let candidate = matchstr(line, regexp)
|
let filename = matchstr(line, regexp)
|
||||||
if len(candidate) > 0
|
if len(filename) > 0
|
||||||
if candidate[0] !=# '/'
|
if filename[0] !=# '/'
|
||||||
let candidate = expand('%:h') . '/' . candidate
|
let candidates = [
|
||||||
|
\ expand('%:h') . '/' . filename,
|
||||||
|
\ getcwd() . '/' . filename,
|
||||||
|
\ ]
|
||||||
|
else
|
||||||
|
let candidates = [fnamemodify(filename, ':p')]
|
||||||
endif
|
endif
|
||||||
let main = fnamemodify(candidate, ':p')
|
for main in candidates
|
||||||
if filereadable(main)
|
if filereadable(main)
|
||||||
return main
|
return main
|
||||||
endif
|
endif
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
Loading…
Reference in New Issue
Block a user