ToC File Opening Confusion #3240
-
|
Despite using vimtex for years, I only just noticed the table of contents functionality and it's great! I am a little confused about how it works in larger multi-file projects. If I open the toc from my |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Glad to hear it!
It should open it in a normal buffer. Perhaps you can share how you've configured VimTeX? I suspect you may be using some custom ToC feature or wrapper. |
Beta Was this translation helpful? Give feedback.
-
|
I found the problem! When I open I updated my LSP config to include this autocmd to the {
"texlab",
enabled = nixCats("latex") or false,
lsp = {
filetypes = { "tex", "bib" },
on_attach = function(client,bufnr)
local group = vim.api.nvim_create_augroup("texlabunlistfix", { clear = true })
vim.api.nvim_create_autocmd("BufEnter", {
group = group,
pattern = "*.tex",
callback = function()
if not vim.bo.buflisted then
vim.bo.buflisted = true
end
end,
})
end,
settings = {
texlab = {
auxDirectory = ".",
bibtexFormatter = "texlab",
build = {
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
executable = "latexmk",
forwardSearchAfter = false,
onSave = false,
},
chktex = {
onEdit = false,
onOpenAndSave = false,
},
diagnosticsDelay = 300,
formatterLineLength = 80,
forwardSearch = {
args = {},
},
latexFormatter = "latexindent",
latexindent = {
modifyLineBreaks = false
},
},
},
},
}, |
Beta Was this translation helpful? Give feedback.
I found the problem! When I open
main.texthe LSP opens all of the referenced files in unlisted buffers so it can scan them and build its own map of the project. If I run:ls!I see all of the files in unlisted buffers. So the ToC is seeing that a buffer for that file already exists and jumps to it (I think).I updated my LSP config to include this autocmd to the
on_attachfunction which seems to fix it:{ "texlab", enabled = nixCats("latex") or false, lsp = { filetypes = { "tex", "bib" }, on_attach = function(client,bufnr) local group = vim.api.nvim_create_augroup("texlabunlistfix", { clear = true }) vim.api.nvim_create_autocmd("BufEnter", { …