lf: add module
Adds 'programs.lf', configuration managment for lf, a terminal file manager. PR #1174
This commit is contained in:
parent
cb17f1ede2
commit
2f2a4396c6
9 changed files with 383 additions and 0 deletions
86
tests/modules/programs/lf/all-options.nix
Normal file
86
tests/modules/programs/lf/all-options.nix
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
pvScript = builtins.toFile "pv.sh" "cat $1";
|
||||
expected = builtins.toFile "settings-expected" ''
|
||||
set icons
|
||||
set noignorecase
|
||||
set ratios "2:2:3"
|
||||
set tabstop 4
|
||||
|
||||
cmd added :echo "foo"
|
||||
cmd multiline :{{
|
||||
push gg
|
||||
echo "bar"
|
||||
push i
|
||||
}}
|
||||
cmd removed
|
||||
|
||||
map aa should-be-added
|
||||
map ab
|
||||
|
||||
cmap <c-a> should-be-added
|
||||
cmap <c-b>
|
||||
|
||||
set previewer ${pvScript}
|
||||
map i ${"$"}${pvScript} "$f" | less -R
|
||||
|
||||
|
||||
|
||||
# More config...
|
||||
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.lf = {
|
||||
enable = true;
|
||||
|
||||
cmdKeybindings = {
|
||||
"<c-a>" = "should-be-added";
|
||||
"<c-b>" = null;
|
||||
};
|
||||
|
||||
commands = {
|
||||
added = '':echo "foo"'';
|
||||
removed = null;
|
||||
multiline = ''
|
||||
:{{
|
||||
push gg
|
||||
echo "bar"
|
||||
push i
|
||||
}}'';
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
# More config...
|
||||
'';
|
||||
|
||||
keybindings = {
|
||||
aa = "should-be-added";
|
||||
ab = null;
|
||||
};
|
||||
|
||||
previewer = {
|
||||
keybinding = "i";
|
||||
source = pvScript;
|
||||
};
|
||||
|
||||
settings = {
|
||||
ignorecase = false;
|
||||
icons = true;
|
||||
tabstop = 4;
|
||||
ratios = "2:2:3";
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/lf/lfrc
|
||||
assertFileContent home-files/.config/lf/lfrc ${expected}
|
||||
'';
|
||||
};
|
||||
}
|
||||
5
tests/modules/programs/lf/default.nix
Normal file
5
tests/modules/programs/lf/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
lf-all-options = ./all-options.nix;
|
||||
lf-minimal-options = ./minimal-options.nix;
|
||||
lf-no-pv-keybind = ./no-pv-keybind.nix;
|
||||
}
|
||||
18
tests/modules/programs/lf/minimal-options.nix
Normal file
18
tests/modules/programs/lf/minimal-options.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let expected = builtins.toFile "settings-expected" "\n\n\n\n\n\n\n\n\n\n\n";
|
||||
in {
|
||||
config = {
|
||||
programs.lf = { enable = true; };
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/lf/lfrc
|
||||
assertFileContent home-files/.config/lf/lfrc ${expected}
|
||||
'';
|
||||
};
|
||||
}
|
||||
43
tests/modules/programs/lf/no-pv-keybind.nix
Normal file
43
tests/modules/programs/lf/no-pv-keybind.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
pvScript = builtins.toFile "pv.sh" "cat $1";
|
||||
expected = builtins.toFile "settings-expected" ''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set previewer ${pvScript}
|
||||
|
||||
|
||||
|
||||
# More config...
|
||||
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.lf = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
# More config...
|
||||
'';
|
||||
|
||||
previewer = { source = pvScript; };
|
||||
};
|
||||
|
||||
nixpkgs.overlays =
|
||||
[ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/lf/lfrc
|
||||
assertFileContent home-files/.config/lf/lfrc ${expected}
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue