1
1
mirror of https://github.com/divnix/digga.git synced 2024-11-27 17:36:06 +03:00

kakoune: add dhall lint and format

This commit is contained in:
Timothy DeHerrera 2020-07-29 23:39:24 -06:00
parent d478059fe8
commit 2d5471681d
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
4 changed files with 25 additions and 1 deletions

View File

@ -39,7 +39,8 @@ let
nixpkgs.overlays = [
(final: prev:
with unstablePkgs; {
inherit starship element-desktop discord signal-desktop mpv;
inherit starship element-desktop discord signal-desktop mpv
dhall;
})
];
};

View File

@ -10,6 +10,7 @@
python3Packages.python-language-server
rustup
nix-linter
dhall
];
environment.etc = {

View File

@ -0,0 +1,9 @@
hook -group lint global WinSetOption filetype=dhall %{
set buffer lintcmd '/etc/xdg/kak/autoload/lint/dhall.sh $1'
lint-enable
set buffer formatcmd "dhall format"
hook buffer BufWritePre .* %{
format
lint
}
}

View File

@ -0,0 +1,13 @@
#!/usr/bin/env zsh
dhall lint --inplace $1 2>&1 | < /dev/stdin > /tmp/lint.out
if head -2 /tmp/lint.out | grep Error &> /dev/null; then
sed -n 4p /tmp/lint.out | tr '\n' ' '
sed -n 2p /tmp/lint.out | tr 'E' 'e' | tr '\n' ';' \
| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
awk 'NR>7 {printf " %s", $0}' /tmp/lint.out
else
true
fi
rm -f /tmp/lint.out