devos/profiles/develop/kakoune/lint/nix.kak

21 lines
471 B
Text
Raw Normal View History

2019-12-15 08:03:57 +01:00
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
2020-01-04 06:06:31 +01:00
set buffer formatcmd "nixfmt"
2019-12-15 08:03:57 +01:00
hook buffer BufWritePre .* %{
format
lint
}
}