tex.lua 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. if require("lv-utils").check_lsp_client_active "texlab" then
  2. return
  3. end
  4. require("lspconfig").texlab.setup {
  5. cmd = { DATA_PATH .. "/lspinstall/latex/texlab" },
  6. on_attach = require("lsp").common_on_attach,
  7. }
  8. vim.g.vimtex_compiler_method = "latexmk"
  9. vim.g.vimtex_view_method = "zathura"
  10. vim.g.vimtex_fold_enabled = 0
  11. vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors
  12. O.plugin.which_key.mappings["L"] = {
  13. name = "+Latex",
  14. c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
  15. f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
  16. i = { "<cmd>VimtexInfo<cr>", "Project Information" },
  17. s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
  18. t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
  19. v = { "<cmd>VimtexView<cr>", "View PDF" },
  20. }
  21. -- Compile on initialization, cleanup on quit
  22. vim.api.nvim_exec(
  23. [[
  24. augroup vimtex_event_1
  25. au!
  26. au User VimtexEventQuit call vimtex#compiler#clean(0)
  27. au User VimtexEventInitPost call vimtex#compiler#compile()
  28. augroup END
  29. ]],
  30. false
  31. )
  32. if O.lang.latex.auto_save then
  33. vim.api.nvim_exec([[au FocusLost * :wa]], false)
  34. end