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:
parent
d478059fe8
commit
2d5471681d
@ -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;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
@ -10,6 +10,7 @@
|
||||
python3Packages.python-language-server
|
||||
rustup
|
||||
nix-linter
|
||||
dhall
|
||||
];
|
||||
|
||||
environment.etc = {
|
||||
|
9
profiles/develop/kakoune/lint/dhall.kak
Normal file
9
profiles/develop/kakoune/lint/dhall.kak
Normal 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
|
||||
}
|
||||
}
|
13
profiles/develop/kakoune/lint/dhall.sh
Executable file
13
profiles/develop/kakoune/lint/dhall.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user