1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2026-03-17 14:14:47 +01:00

nvim: complete refactoring

This commit is contained in:
2026-03-14 09:42:33 +01:00
parent 63507160ce
commit f909309e15
56 changed files with 1135 additions and 911 deletions

View File

@@ -1,9 +1,8 @@
return {
{
'frabjous/knap',
ft = { 'tex' },
"frabjous/knap",
ft = { "tex" },
config = function()
local function detect_engine()
local first_line = vim.api.nvim_buf_get_lines(0, 0, 1, false)[1] or ""
if first_line:match("^%%%s*xelatex") then
@@ -17,11 +16,9 @@ return {
local engine = detect_engine()
if engine == "xelatex" then
vim.g.knap_settings.textopdf =
"xelatex -synctex=1 -interaction=batchmode %docroot%"
vim.g.knap_settings.textopdf = "xelatex -synctex=1 -interaction=batchmode %docroot%"
else
vim.g.knap_settings.textopdf =
"pdflatex -synctex=1 -interaction=batchmode %docroot%"
vim.g.knap_settings.textopdf = "pdflatex -synctex=1 -interaction=batchmode %docroot%"
end
end
@@ -29,27 +26,25 @@ return {
delay = 100,
texoutputext = "pdf",
textopdf = "xelatex -synctex=1 -interaction=batchmode %docroot%",
textopdfviewerlaunch =
"zathura --synctex-editor-command 'nvim --headless -es --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%{input}'\"'\"',%{line},0)\"' ./%outputfile%",
textopdfviewerlaunch = "zathura --synctex-editor-command 'nvim --headless -es --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%{input}'\"'\"',%{line},0)\"' ./%outputfile%",
textopdfviewerrefresh = "reload",
textopdfforwardjump =
"zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%",
textopdfforwardjump = "zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%",
}
vim.api.nvim_create_autocmd("User", {
pattern = "KnapShowView",
callback = set_engine
callback = set_engine,
})
vim.api.nvim_create_autocmd("User", {
pattern = "KnapCompile",
callback = set_engine
callback = set_engine,
})
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.tex",
callback = set_engine
callback = set_engine,
})
end
}
end,
},
}