mirror of
https://github.com/nix-community/home-manager
synced 2025-01-11 19:49:49 +01:00
zsh: add history.save option
This commit is contained in:
parent
dbcb3dd1ae
commit
a93445f3fe
1 changed files with 16 additions and 8 deletions
|
@ -19,7 +19,7 @@ let
|
||||||
|
|
||||||
zdotdir = "$HOME/" + cfg.dotDir;
|
zdotdir = "$HOME/" + cfg.dotDir;
|
||||||
|
|
||||||
historyModule = types.submodule {
|
historyModule = types.submodule ({ config, ... }: {
|
||||||
options = {
|
options = {
|
||||||
size = mkOption {
|
size = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
|
@ -27,6 +27,13 @@ let
|
||||||
description = "Number of history lines to keep.";
|
description = "Number of history lines to keep.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
save = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
defaultText = 10000;
|
||||||
|
default = config.size;
|
||||||
|
description = "Number of history lines to save.";
|
||||||
|
};
|
||||||
|
|
||||||
path = mkOption {
|
path = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = relToDotDir ".zsh_history";
|
default = relToDotDir ".zsh_history";
|
||||||
|
@ -49,7 +56,7 @@ let
|
||||||
description = "Share command history between zsh sessions.";
|
description = "Share command history between zsh sessions.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
|
|
||||||
pluginModule = types.submodule ({ config, ... }: {
|
pluginModule = types.submodule ({ config, ... }: {
|
||||||
options = {
|
options = {
|
||||||
|
@ -247,10 +254,6 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
home.file."${relToDotDir ".zshrc"}".text = ''
|
home.file."${relToDotDir ".zshrc"}".text = ''
|
||||||
setopt HIST_FCNTL_LOCK
|
|
||||||
${if cfg.history.ignoreDups then "setopt" else "unsetopt"} HIST_IGNORE_DUPS
|
|
||||||
${if cfg.history.share then "setopt" else "unsetopt"} SHARE_HISTORY
|
|
||||||
|
|
||||||
fpath+="$HOME/.nix-profile/share/zsh/site-functions"
|
fpath+="$HOME/.nix-profile/share/zsh/site-functions"
|
||||||
fpath+="$HOME/.nix-profile/share/zsh/$ZSH_VERSION/functions"
|
fpath+="$HOME/.nix-profile/share/zsh/$ZSH_VERSION/functions"
|
||||||
|
|
||||||
|
@ -284,10 +287,15 @@ in
|
||||||
source "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}"
|
source "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}"
|
||||||
'') cfg.plugins)}
|
'') cfg.plugins)}
|
||||||
|
|
||||||
# HISTSIZE, HISTFILE have to be set in .zshrc and after oh-my-zsh sourcing
|
# History options should be set in .zshrc and after oh-my-zsh sourcing.
|
||||||
# see https://github.com/rycee/home-manager/issues/177
|
# See https://github.com/rycee/home-manager/issues/177.
|
||||||
HISTSIZE="${toString cfg.history.size}"
|
HISTSIZE="${toString cfg.history.size}"
|
||||||
HISTFILE="$HOME/${cfg.history.path}"
|
HISTFILE="$HOME/${cfg.history.path}"
|
||||||
|
SAVEHIST="${toString cfg.history.save}"
|
||||||
|
|
||||||
|
setopt HIST_FCNTL_LOCK
|
||||||
|
${if cfg.history.ignoreDups then "setopt" else "unsetopt"} HIST_IGNORE_DUPS
|
||||||
|
${if cfg.history.share then "setopt" else "unsetopt"} SHARE_HISTORY
|
||||||
|
|
||||||
${cfg.initExtra}
|
${cfg.initExtra}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue