nix-dotfiles/programs/kakoune.nix
vorboyvo 2ae1a7c01c Added Kakoune hook to compile LaTeX on save.
Added Kakoune settings to disable removing trailing indentation and enable highlighting it.
2024-04-11 15:54:41 -04:00

48 lines
1.2 KiB
Nix

{
enable = true;
defaultEditor = true;
config = {
colorScheme = "tomorrow-night";
numberLines = {
enable = true;
highlightCursor = true;
};
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 = "hook buffer BufWritePost .* %{ texlab-build }";
}
];
keyMappings = [
# Define usermode yank/copy and paste
{
key = "y";
mode = "user";
effect = "<a-|> wl-copy<ret>";
}
{
key = "p";
mode = "user";
effect = "<a-!> wl-paste<ret>;d"; # ;d at the end since newline inserted
}
{
key = "P";
mode = "user";
effect = "! wl-paste<ret>;d"; # ;d at the end since newline inserted
}
];
};
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
'';
}