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 = [ nixpkgs.overlays = [
(final: prev: (final: prev:
with unstablePkgs; { 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 python3Packages.python-language-server
rustup rustup
nix-linter nix-linter
dhall
]; ];
environment.etc = { 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