vimtex icon indicating copy to clipboard operation
vimtex copied to clipboard

[help] Is there possible way for another plugin to get mainfile path that vimtex finds?

Open berryoptml opened this issue 2 years ago • 1 comments

vimtex handles multi-file projects well. for this it finds path of main-file in the project that is to be compiled. I want to use this path in my plugin / script.

would it be possible me to get this path when a project is from a plugin in vim/neovim ?

this could be a dumb question to start with but fairly new here. Any help or link to resources in this direction is appreciated.

berryoptml avatar Apr 03 '24 10:04 berryoptml

for this it finds path of main-file in the project that is to be compiled. I want to use this path in my plugin / script.

If we are in the context of a Vimscript or Lua plugin, then this should be quite easy. The path is available in b:vimtex.tex (or vim.b.vimtex.tex in Lua). This is only available in the VimTeX buffers, of course, so you may want to put some guards, e.g.:

if exists('b:vimtex.tex')
  " Do stuff...
endif

this could be a dumb question to start with but fairly new here. Any help or link to resources in this direction is appreciated.

I wouldn't call this a dumb question, so don't worry.

lervag avatar Apr 03 '24 21:04 lervag