Skip to content

Commit eebbbf6

Browse files
authored
Merge pull request #137 from Mrid22/better-history
modules/zsh: use config instead of flags for history + share history option
2 parents c954a7c + 430bc5e commit eebbbf6

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

modules/zsh/module.nix

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ in
117117
"match_prev_cmd"
118118
]
119119
);
120-
default = [ "history" ];
120+
default = [
121+
"history"
122+
"completion"
123+
];
121124
};
122125
};
123126

@@ -132,6 +135,11 @@ in
132135
default = false;
133136
description = "save timestamps with history";
134137
};
138+
share = lib.mkOption {
139+
type = lib.types.bool;
140+
default = false;
141+
description = "share history between sessions";
142+
};
135143
save = lib.mkOption {
136144
type = lib.types.int;
137145
default = 10000;
@@ -243,6 +251,15 @@ in
243251
"HISTSIZE=${toString cfg.history.size}"
244252
"HISTSAVE=${toString cfg.history.save}"
245253

254+
(lib.optionalString cfg.history.append "setopt appendhistory")
255+
(lib.optionalString cfg.history.share "setopt sharehistory")
256+
(lib.optionalString cfg.history.ignoreSpace "setopt hist_ignore_space")
257+
(lib.optionalString cfg.history.ignoreAllDups "setopt hist_ignore_all_dups")
258+
(lib.optionalString cfg.history.ignoreDups "setopt hist_ignore_dups")
259+
(lib.optionalString cfg.history.saveNoDups "setopt hist_save_no_dups")
260+
(lib.optionalString cfg.history.findNoDups "setopt histfindnodups")
261+
(lib.optionalString cfg.history.expanded "setopt extendedhistory")
262+
246263
"# Extra Content"
247264

248265
config.extraRC
@@ -274,14 +291,7 @@ in
274291

275292
flags = {
276293
"--histfcntllock" = true;
277-
"--histappend" = cfg.history.append;
278294
"--histexpiredupsfirst" = cfg.history.expireDupsFirst;
279-
"--histfindnodups" = cfg.history.findNoDups;
280-
"--histignorealldups" = cfg.history.ignoreAllDups;
281-
"--histignoredups" = cfg.history.ignoreDups;
282-
"--histignorespace" = cfg.history.ignoreSpace;
283-
"--histsavenodups" = cfg.history.saveNoDups;
284-
"--histexpand" = cfg.history.expanded;
285295
};
286296

287297
env.ZDOTDIR = builtins.toString (

0 commit comments

Comments
 (0)