Skip to content

Commit

Permalink
Get vimtex root from variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
rpapallas committed Apr 5, 2024
1 parent 17ab0ac commit 98b016f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lua/illustrate/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function M.get_path_to_illustration_dir()

local vimtex = vim.b.vimtex ~= nil
if vimtex then
local root_folder = vim.fn.fnamemodify(vim.b.vimtex.tex, ":h")
local figures_dir = root_folder .. '/' .. directory_name
local figures_dir = vim.b.vimtex.root .. '/' .. directory_name
if directory_exists(figures_dir) then
return figures_dir
else
Expand Down Expand Up @@ -120,8 +119,8 @@ local function create_illustration_dir()
-- If Vimtex plugin is used, override the path with it.
local vimtex = vim.b.vimtex ~= nil
if vimtex then
local root_folder = vim.fn.fnamemodify(vim.b.vimtex.tex, ":h")
figures_dir = root_folder .. '/' .. illustration_dir
vim.notify(vim.b.vimtex.root)
figures_dir = vim.b.vimtex.root .. '/' .. illustration_dir
end

vim.fn.mkdir(figures_dir, "p")
Expand Down

0 comments on commit 98b016f

Please sign in to comment.