1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-18 13:41:33 +03:00
digga/profiles/develop/kakoune/lint/nix.kak
2020-01-03 22:06:31 -07:00

21 lines
471 B
Plaintext

hook -group lint global WinSetOption filetype=nix %{
# remove '' for nix, annoying for string literals
set buffer auto_pairs ( ) { } [ ] '"' '"' ` `
set buffer lintcmd '
run () {
nix-instantiate --parse $1 2>&1 >&- > /dev/null |
awk ''
{printf $NF ":" " "}
!($NF="") !($(NF-1)="") {sub(/, $/, "")}1
''
} && run \
'
lint-enable
set buffer formatcmd "nixfmt"
hook buffer BufWritePre .* %{
format
lint
}
}