blob: 6cdb1638a3ad7ec97c34881d547d9050635e21d1 [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 Greyec50d242024-02-15 23:09:46 +000027 EDITOR = "${pkgs.ed}/bin/ed${
28 if config.chimera.editor.ed.prompt != null then " -p '${config.chimera.editor.ed.prompt}'" else ""
29 }";
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050030 };
31 };
32}