This commit is contained in:
sharings 2025-07-26 12:43:01 +00:00
commit 1e2ca5a6fc
71 changed files with 3330 additions and 0 deletions

View file

@ -0,0 +1,117 @@
{
lib,
helpers,
...
}:
let
inherit (helpers) mkRaw;
use_tectonic = false;
in
{
plugins.lsp.servers = {
texlab = {
enable = true;
filetypes = [
"tex"
"plaintex"
"bib"
];
settings = {
texlab = {
# --------------------------------
# -- START texlab main config
# -- if used with texmagic, disable this
# --------------------------------
# https://github.com/latex-lsp/texlab/wiki/Configuration#deprecated-texlabauxdirectory
# auxDirectory = "tex_aux_output"; # deprecated
rootDirectory = false;
build = lib.mkMerge [
(lib.mkIf (!use_tectonic) {
executable = "latexmk";
args = [
"-xelatex"
"-verbose"
# -- "-outdir=%f_output"
# -- "-auxdir=%f_aux"
"-auxdir=tex_aux_output"
"-file-line-error"
# https://github.com/latex-lsp/texlab/wiki/Previewing
# use for forward serach and inverse search
"-synctex=1"
"-interaction=nonstopmode"
# "-pvc" # preview continuously update instead if -pv (open a new instance)
"%f"
];
})
(lib.mkIf use_tectonic {
executable = "tectonic";
# https://github.com/latex-lsp/texlab/wiki/Tectonic
# V2
args = [
"-X"
"compile"
"%f"
"--synctex"
"--keep-logs"
"--keep-intermediates"
];
})
{
auxDirectory = "tex_aux_output";
logDirectory = "tex_aux_output";
pdfDirectory = ".";
# -- forwardSearchAfter = true,
isContinuous = true;
# -- "onSave = true" failed to work properly with large files like moderncv
# -- it would not build properly until you delete all the intermediate files
onSave = true;
# --------------------------------
# -- END texlab main config
# -- if used with texmagic, disable this
# --------------------------------
# https://github.com/latex-lsp/texlab/wiki/Previewing#zathura
}
];
forwardSearch = {
executable = "zathura";
args = [
"--synctex-forward"
"%l:1:%f"
"%p"
];
};
# Inverse Search for zathura set in ~/.config/zathura/zathurarc
# set synctex true
# set synctex-editor-command "texlab inverse-search -i %{input} -l %{line}"
chktex = {
onOpenAndSave = true;
onEdit = true;
};
# https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/texlab.lua#L179-L183
# https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/texlab.lua#L179-L183
latexindent = {
local = ./indentconfig.yaml;
};
};
};
};
};
autoCmd = [
{
pattern = [ "tex" ];
event = [ "FileType" ];
callback = mkRaw ''
function()
-- vim.keymap.set( 'n', '<leader>TH', "<CMD>TexlabBuild<CR>", { desc = 'TexlabBuild' })
-- vim.keymap.set( 'n', '<leader>TD', "<CMD>TexlabCleanAuxiliary<CR>", { desc = 'TexlabCleanAuxiliary' })
-- vim.keymap.set( 'n', '<leader>TN', "<CMD>TexlabForward<CR>", { desc = 'TexlabForward' })
vim.keymap.set( 'n', '<leader>TH', function() vim.cmd.TexlabBuild() end, { desc = 'TexlabBuild' })
vim.keymap.set( 'n', '<leader>TD', function() vim.cmd.TexlabCancelBuild(); vim.cmd.TexlabCleanAuxiliary() end, { desc = 'TexlabCancelBuild+CleanAuxiliary' })
vim.keymap.set( 'n', '<leader>Td', function() vim.cmd.TexlabCleanArtifacts() end, { desc = 'TexlabCleanArtifacts' })
vim.keymap.set( 'n', '<leader>TN', function() vim.cmd.TexlabForward() end, { desc = 'TexlabForward' })
end
'';
}
];
}