texmagic.nvim icon indicating copy to clipboard operation
texmagic.nvim copied to clipboard

```_G.TeXMagicBuildConfig``` is nil

Open SivanLaai opened this issue 9 months ago • 1 comments

I use Nvchad as my nvimrc.

I install texlab and texmagic in my nvim, but _G.TeXMagicBuildConfig is nil, which can't be used in TexBuild. TexBuild use the default config to generate files in current directory.

I add texmagic in file custom\plugins.lua

  {
    lazy = false,
    "jakewvincent/texmagic.nvim",
    config = function()
      require("custom.configs.texmagic")
    end,
  },

custom.configs.texmagic

require('texmagic').setup{
    engines = {
        pdflatex = {    -- This has the same name as a default engine but would
                        -- be preferred over the same-name default if defined
            executable = "latexmk",
            args = {
                "-pdflatex",
                "-interaction=nonstopmode",
                "-synctex=1",
                "-outdir=.build",
                "-pv",
                "%f"
            },
            isContinuous = false
        },
        lualatex = {    -- This is *not* one of the defaults, but it can be
                        -- called via magic comment if defined here
            executable = "latexmk",
            args = {
                "-pdflua",
                "-interaction=nonstopmode",
                "-synctex=1",
                "-pv",
                "%f"
            },
            isContinuous = false
        }
    }
}

lspconfig

lspconfig.texlab.setup({
  cmd = { vim.fn.exepath("texlab") },
  filetypes = {"tex", "bib"},
  on_attach = on_attach,
	capabilities = capabilities,
	settings = {
		texlab = {
      rootDirectory = nil,
      --      ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
      build = _G.TeXMagicBuildConfig,
      --      ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
      --
      ------------------------------- 
			--build = {
			--	executable = "latexmk",
			--	args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
			--	onSave = false,
			--	forwardSearchAfter = true,
			--},
			chktex = {
				onOpenAndSave = true,
			},
			forwardSearch = {
				executable = "SumatraPDF",
				args = { "%p" },
			},
		},
	},
})

relative value

Value Info
TeXMagicConfigFound nil
TeXMagicCommentsFound false
TeXMagicSelectedProgram No program selected
TeXMagicShowComments nil
TeXMagicSetupStatus true
TeXMagicLoaded 1

SivanLaai avatar Sep 21 '23 08:09 SivanLaai