blob: e7b2b3c95254efa1f56a21a64219c324a6046a99 [file] [log] [blame]
Samuel Shuert02ffd1e2024-02-13 21:37:15 -05001{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7{
8 options.chimera.editor.ed = {
9 enable = lib.mkEnableOption "Enable the standard text editor, the greatest WYGIWYG editor of all, the only viable text editor, Ed";
10 defaultEditor = lib.mkOption {
11 type = lib.types.bool;
12 description = "Use Ed as the default editor";
13 default = true;
14 };
Skyler Greye4da8cb2024-02-15 19:53:53 +000015 prompt = lib.mkOption {
16 type = lib.types.nullOr lib.types.str;
17 description = "What prompt should show up in command mode?";
18 default = null;
19 example = ":";
20 };
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050021 };
22
23 config = lib.mkIf config.chimera.editor.ed.enable {
24 home.packages = [ pkgs.ed ];
25
26 home.sessionVariables = lib.mkIf config.chimera.editor.ed.defaultEditor {
Skyler Greye4da8cb2024-02-15 19:53:53 +000027 EDITOR = "${pkgs.ed}/bin/ed${if config.chimera.editor.ed.prompt != null then " -p '${config.chimera.editor.ed.prompt}'" else ""}";
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050028 };
29 };
30}