summaryrefslogtreecommitdiff
path: root/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/tex.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/ftplugin/tex.lua b/ftplugin/tex.lua
index b565c48..5df3dd9 100644
--- a/ftplugin/tex.lua
+++ b/ftplugin/tex.lua
@@ -1,2 +1,7 @@
-- Configure the compiler for latex
-vim.opt_local.makeprg = 'pdflatex -interaction=nonstopmode -file-line-error -synctex=1 %'
+
+local function tex_root()
+ return vim.fn.system('grep -rl -m 1 --include "*.tex" "documentclass"')
+end
+
+vim.opt_local.makeprg = "pdflatex -interaction=nonstopmode -file-line-error -synctex=1 " .. tex_root()