From 2ae1a7c01c0dcf1db49fc90a588055e79493161a Mon Sep 17 00:00:00 2001 From: vorboyvo Date: Thu, 11 Apr 2024 15:54:41 -0400 Subject: [PATCH] Added Kakoune hook to compile LaTeX on save. Added Kakoune settings to disable removing trailing indentation and enable highlighting it. --- programs/kakoune.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/programs/kakoune.nix b/programs/kakoune.nix index 067a16b..f842aa8 100644 --- a/programs/kakoune.nix +++ b/programs/kakoune.nix @@ -9,11 +9,10 @@ }; hooks = [ { + # When the filetype=latex option is set in a buffer context (automatically), add a new hook to build the latex file on write name = "BufSetOption"; option = "filetype=latex"; - commands = '' - set-option buffer makecmd latexmk -pvc -pdf -e '$pdf_previewer="xdg-open %S"' -e '$pdflatex="pdflatex -interaction=nonstopmode -synctex=1 %O %S"' %opt{documentsrc} - ''; + commands = "hook buffer BufWritePost .* %{ texlab-build }"; } ]; keyMappings = [ @@ -36,6 +35,12 @@ ]; }; extraConfig = '' + # highlight trailing whitespace + add-highlighter global/trailing-whitespace regex '\h+$' 0:Error + + # don't remove trailing indent + set global disabled_hooks .*-trim-indent + eval %sh{kak-lsp --kakoune -s $kak_session} lsp-enable '';