mirror of
https://github.com/nix-community/home-manager
synced 2024-12-23 18:29:47 +01:00
kakoune: implement whitespace highlighter config
The options under `programs.kakoune.config.showWhitespace` existed but were not implemented. PR #1162
This commit is contained in:
parent
f6afd95ef8
commit
86ccd8fecb
4 changed files with 45 additions and 0 deletions
|
@ -513,6 +513,15 @@ let
|
||||||
"${optionalString (separator != null) " -separator ${separator}"}"
|
"${optionalString (separator != null) " -separator ${separator}"}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
showWhitespaceOptions = with cfg.config.showWhitespace;
|
||||||
|
concatStrings [
|
||||||
|
(optionalString (tab != null) " -tab ${tab}")
|
||||||
|
(optionalString (tabStop != null) " -tabpad ${tabStop}")
|
||||||
|
(optionalString (space != null) " -spc ${space}")
|
||||||
|
(optionalString (nonBreakingSpace != null) " -nbsp ${nonBreakingSpace}")
|
||||||
|
(optionalString (lineFeed != null) " -lf ${lineFeed}")
|
||||||
|
];
|
||||||
|
|
||||||
uiOptions = with cfg.config.ui;
|
uiOptions = with cfg.config.ui;
|
||||||
concatStringsSep " " [
|
concatStringsSep " " [
|
||||||
"ncurses_set_title=${if setTitle then "true" else "false"}"
|
"ncurses_set_title=${if setTitle then "true" else "false"}"
|
||||||
|
@ -572,6 +581,8 @@ let
|
||||||
++ optional (numberLines != null && numberLines.enable)
|
++ optional (numberLines != null && numberLines.enable)
|
||||||
"add-highlighter global/ number-lines${numberLinesOptions}"
|
"add-highlighter global/ number-lines${numberLinesOptions}"
|
||||||
++ optional showMatching "add-highlighter global/ show-matching"
|
++ optional showMatching "add-highlighter global/ show-matching"
|
||||||
|
++ optional (showWhitespace != null && showWhitespace.enable)
|
||||||
|
"add-highlighter global/ show-whitespaces${showWhitespaceOptions}"
|
||||||
++ optional (scrollOff != null)
|
++ optional (scrollOff != null)
|
||||||
"set-option global scrolloff ${toString scrollOff.lines},${
|
"set-option global scrolloff ${toString scrollOff.lines},${
|
||||||
toString scrollOff.columns
|
toString scrollOff.columns
|
||||||
|
|
|
@ -32,6 +32,7 @@ import nmt {
|
||||||
./modules/programs/fish
|
./modules/programs/fish
|
||||||
./modules/programs/git
|
./modules/programs/git
|
||||||
./modules/programs/gpg
|
./modules/programs/gpg
|
||||||
|
./modules/programs/kakoune
|
||||||
./modules/programs/lieer
|
./modules/programs/lieer
|
||||||
./modules/programs/mbsync
|
./modules/programs/mbsync
|
||||||
./modules/programs/neomutt
|
./modules/programs/neomutt
|
||||||
|
|
1
tests/modules/programs/kakoune/default.nix
Normal file
1
tests/modules/programs/kakoune/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ kakoune-whitespace-highlighter = ./whitespace-highlighter.nix; }
|
32
tests/modules/programs/kakoune/whitespace-highlighter.nix
Normal file
32
tests/modules/programs/kakoune/whitespace-highlighter.nix
Normal 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'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue