1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2026-08-25 21:41:36 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
731ba1b0f4 Nvim: Updated knap to use working dynamic engine selection 2026-07-17 07:18:46 +02:00
52521ae0d1 Nvim: Updated dictionaries 2026-07-17 07:00:19 +02:00
4 changed files with 100 additions and 38 deletions

View File

@@ -1,3 +1,4 @@
dockerized dockerized
keymap keymap
spectogram
synaptics synaptics

View File

@@ -3,6 +3,8 @@ APV
Abdulkarim Abdulkarim
Accuracy Accuracy
Agentic Agentic
Airsonic
Airsonic-Advanced
Akallabêth Akallabêth
Altisaur Altisaur
An An
@@ -46,6 +48,8 @@ Color
Combi Combi
Commander Commander
Crusader Crusader
DAW
DAWs
DFKI DFKI
DFKIs DFKIs
DPU DPU
@@ -55,6 +59,7 @@ DeepSeek
Dekarldent Dekarldent
Delivery Delivery
Destiny Destiny
Discogs
Distrobox Distrobox
Doom Doom
Doyma Doyma
@@ -73,14 +78,17 @@ FIDO
Face Face
Fischerhude Fischerhude
Flac Flac
FluidSynth
Forest Forest
Forgejo Forgejo
Französischmodul Französischmodul
Freizeitkarte
Frevert Frevert
Freverts Freverts
Friedl Friedl
Friesenturnier Friesenturnier
Gathering Gathering
Geofabrik
GitNex GitNex
Glaive Glaive
Glenn Glenn
@@ -153,6 +161,7 @@ Marten
Mathis Mathis
Matvey Matvey
Mauli Mauli
MediaInfo
Mentos Mentos
Meret Meret
Meshtastic Meshtastic
@@ -160,6 +169,7 @@ Metzener
MiiMii MiiMii
Mint Mint
Mukluk Mukluk
MusicBrainz
MusikAka MusikAka
MusikAkademie MusikAkademie
NVIM NVIM
@@ -181,6 +191,7 @@ Oberhausern
Oberweseler Oberweseler
Odysee Odysee
Opam Opam
OpenAudible
OpenCloud OpenCloud
Ove Ove
Overwatch Overwatch
@@ -194,6 +205,7 @@ PfingstAka
PfingstAkademie PfingstAkademie
Pillion Pillion
Pluribus Pluribus
Podgrab
PopOS PopOS
Portainer Portainer
Power Power
@@ -202,6 +214,8 @@ Precision
Precon Precon
Precons Precons
PyEnv PyEnv
QMapShack
Qobuz
RStudio RStudio
Rebowl Rebowl
Reed Reed
@@ -209,6 +223,7 @@ Reeves
Reichenecker Reichenecker
Rida Rida
Rocq Rocq
Routino
Ruschenbaum Ruschenbaum
SDS SDS
SPM SPM
@@ -230,6 +245,7 @@ SommerAka
SommerAkademie SommerAkademie
Souleyman Souleyman
SpotiFLAC SpotiFLAC
Spotlistr
Sprave Sprave
Stina Stina
Stud.IP Stud.IP
@@ -264,17 +280,26 @@ Years
Yorma Yorma
Ziegeleiweg Ziegeleiweg
Zimin Zimin
aac
aiff
alac
and and
baseimage-gui baseimage-gui
ctop ctop
dts
eKiwi eKiwi
flac flac
fre:ac
glaive glaive
inf inf
jlesages jlesages
liquidctl liquidctl
metaflac
npy npy
ramdisk ramdisk
systemd systemd
wav
wma
xinput xinput
yt-dl
zedbraxmen zedbraxmen

View File

@@ -4,48 +4,68 @@ return {
keys = { keys = {
{ {
"<leader>p", "<leader>p",
function() require("knap").toggle_autopreviewing() end, function()
require("knap").toggle_autopreviewing()
end,
desc = "Knap: toggle autopreview", desc = "Knap: toggle autopreview",
}, },
}, },
config = function() config = function()
local knap = require("knap") local knap = require("knap")
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
return "xelatex"
else
return "pdflatex"
end
end
local function set_engine()
local engine = detect_engine()
if engine == "xelatex" then
vim.g.knap_settings.textopdf = "xelatex -synctex=1 -interaction=batchmode %docroot%"
else
vim.g.knap_settings.textopdf = "pdflatex --shell-escape -synctex=1 -interaction=batchmode %docroot%"
end
end
vim.g.knap_settings = { vim.g.knap_settings = {
delay = 100, delay = 100,
texoutputext = "pdf", texoutputext = "pdf",
-- textopdf = "pdflatex --shell-escape -synctex=1 -interaction=batchmode %docroot%", textopdf = "pdflatex --shell-escape -synctex=1 -interaction=batchmode %docroot%",
textopdf = "xelatex -synctex=1 -interaction=batchmode %docroot%", textopdfviewerlaunch = "zathura --synctex-editor-command "
textopdfviewerlaunch = "zathura --synctex-editor-command 'nvim --headless -es --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%{input}'\"'\"',%{line},0)\"' ./%outputfile%", .. "'nvim --headless -es --cmd "
textopdfviewerrefresh = "reload", .. "\"lua require('\"'\"'knaphelper'\"'\"').relayjump("
.. "'\"'\"'%servername%'\"'\"',"
.. "'\"'\"'%{input}'\"'\"',%{line},0)\"' "
.. "%outputfile%",
textopdfviewerrefresh = "none",
textopdfforwardjump = "zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%", textopdfforwardjump = "zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%",
} }
vim.api.nvim_create_autocmd("User", { local function set_tex_engine(bufnr)
pattern = "KnapShowView", bufnr = bufnr or vim.api.nvim_get_current_buf()
callback = set_engine, if not vim.api.nvim_buf_is_valid(bufnr) then
}) return
vim.api.nvim_create_autocmd("User", { end
pattern = "KnapCompile", local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 15, false)
callback = set_engine, local use_xelatex = false
}) for _, line in ipairs(lines) do
vim.api.nvim_create_autocmd("BufWritePost", { local lower = line:lower()
-- Detect XeLaTeX from the first 15 lines. Supported forms include the following.
-- % !TeX program = xelatex
-- % xelatex
-- and packages which require or commonly imply XeLaTeX.
if
lower:match("^%%+%s*!tex%s+program%s*=%s*xelatex")
or lower:match("^%%+%s*xelatex%s*$")
or lower:match("\\usepackage[^}]*{fontspec}")
or lower:match("\\usepackage[^}]*{unicode%-math}")
or lower:match("\\usepackage[^}]*{mathspec}")
then
use_xelatex = true
break
end
end
local settings = vim.b[bufnr].knap_settings or {}
if use_xelatex then
settings.textopdf = "xelatex --shell-escape -synctex=1 -interaction=batchmode %docroot%"
else
settings.textopdf = "pdflatex --shell-escape -synctex=1 -interaction=batchmode %docroot%"
end
vim.b[bufnr].knap_settings = settings
end
vim.api.nvim_create_autocmd({
"BufReadPost",
"BufNewFile",
"BufWritePost",
}, {
pattern = "*.tex", pattern = "*.tex",
callback = set_engine, callback = function(args)
set_tex_engine(args.buf)
end,
}) })
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { "tex", "markdown" }, pattern = { "tex", "markdown" },
@@ -58,6 +78,7 @@ return {
desc = "Knap: jump to cursor", desc = "Knap: jump to cursor",
}) })
if vim.bo[bufnr].filetype == "tex" then if vim.bo[bufnr].filetype == "tex" then
set_tex_engine(bufnr)
knap.toggle_autopreviewing() knap.toggle_autopreviewing()
end end
end, end,

29
.local/bin/etc/nvim/compiler Executable file → Normal file
View File

@@ -27,13 +27,28 @@ has_python_version() {
textype() { textype() {
command="pdflatex --shell-escape" command="pdflatex --shell-escape"
(sed 5q "$file" | grep -i -q 'xelatex') && command="xelatex" # Detect XeLaTeX from the first 15 lines. Supported forms include:
$command --output-directory="$dir" "$base" && # % !TeX program = xelatex
grep -i addbibresource "$file" >/dev/null && # % xelatex
biber --input-directory "$dir" "$base" && # and packages which require or commonly imply XeLaTeX.
$command --output-directory="$dir" "$base" && if sed -n '1,15p' "$file" | grep -Eiq \
makeglossaries "$basenodir" && '(^%+[[:space:]]*!tex[[:space:]]+program[[:space:]]*=[[:space:]]*xelatex)|(^%+[[:space:]]*xelatex[[:space:]]*$)|(\\usepackage[^}]*\{(fontspec|unicode-math|mathspec)\})'; then
$command --output-directory="$dir" "$base" command="xelatex"
fi
$command --output-directory="$dir" "$base" || return 1
if grep -iq '\\addbibresource' "$file"; then
biber --input-directory "$dir" "$base" || return 1
$command --output-directory="$dir" "$base" || return 1
fi
if grep -iq '\\makeglossaries' "$file"; then
makeglossaries "$basenodir" || return 1
$command --output-directory="$dir" "$base" || return 1
fi
return 0
} }
case "$file" in case "$file" in