kakoune: implement whitespace highlighter config

The options under `programs.kakoune.config.showWhitespace` existed
but were not implemented.

PR #1162
This commit is contained in:
Robin Stumm 2020-04-16 13:36:21 +02:00 committed by Robert Helgesson
parent f6afd95ef8
commit 86ccd8fecb
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1 @@
{ kakoune-whitespace-highlighter = ./whitespace-highlighter.nix; }

View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.kakoune = {
enable = true;
config.showWhitespace = {
enable = true;
lineFeed = "1";
space = "2";
nonBreakingSpace = "3";
tab = "4";
tabStop = "5";
};
};
nmt.script = let
lineStart =
"^add-highlighter\\s\\+global\\/\\?\\s\\+show-whitespaces\\s\\+"
+ "\\(-\\w\\+\\s\\+.\\s\\+\\)*";
in ''
assertFileExists home-files/.config/kak/kakrc
assertFileRegex home-files/.config/kak/kakrc '${lineStart}-lf\s\+1\b'
assertFileRegex home-files/.config/kak/kakrc '${lineStart}-spc\s\+2\b'
assertFileRegex home-files/.config/kak/kakrc '${lineStart}-nbsp\s\+3\b'
assertFileRegex home-files/.config/kak/kakrc '${lineStart}-tab\s\+4\b'
assertFileRegex home-files/.config/kak/kakrc '${lineStart}-tabpad\s\+5\b'
'';
};
}