feat(zsh): add some nice to haves

This commit is contained in:
Mohammad Rafiq 2025-05-21 14:33:16 +08:00
parent eb3eea721d
commit 565d9b8948
No known key found for this signature in database
3 changed files with 28 additions and 16 deletions

View file

@ -5,6 +5,7 @@
}: }:
{ {
cli.shell = "zsh"; cli.shell = "zsh";
cli.enableScreensaver = true;
cli.editor = "nvf"; cli.editor = "nvf";
cli.file-browser = "yazi"; cli.file-browser = "yazi";
cli.multiplexer = "zellij"; cli.multiplexer = "zellij";

View file

@ -7,6 +7,7 @@
{ {
options.cli = { options.cli = {
shell = lib.pantheon.mkStrOption; shell = lib.pantheon.mkStrOption;
enableScreensaver = lib.mkEnableOption "";
editor = lib.pantheon.mkStrOption; editor = lib.pantheon.mkStrOption;
file-browser = lib.pantheon.mkStrOption; file-browser = lib.pantheon.mkStrOption;
multiplexer = lib.pantheon.mkStrOption; multiplexer = lib.pantheon.mkStrOption;

View file

@ -2,18 +2,28 @@
{ {
config = lib.mkIf (config.cli.shell == "zsh") { config = lib.mkIf (config.cli.shell == "zsh") {
home.sessionVariables.SHELL = "zsh"; home.sessionVariables.SHELL = "zsh";
home.persistence."/persist/home/${config.snowfallorg.user.name}".files = [ ".zsh_history" ];
programs.zsh = { programs.zsh = {
enable = true; enable = true;
enableVteIntegration = true; enableVteIntegration = true;
syntaxHighlighting.enable = true; syntaxHighlighting.enable = true;
history.share = true; historySubstringSearch.enable = true;
history.size = 10000; history = {
history.ignoreDups = true; append = true;
history.ignoreSpace = true; extended = true;
initContent = ignoreDups = true;
ignoreSpace = true;
save = 10000;
share = true;
size = 10000;
};
};
programs.zsh.initContent = lib.mkIf config.cli.enableScreensaver (
lib.mkOrder 1200 lib.mkOrder 1200
# zsh # zsh
'' ''
setopt PROMPT_SUBST
PROMPT='> '
RPROMPT='[%D{%L:%M:%S %p}]' RPROMPT='[%D{%L:%M:%S %p}]'
TMOUT=1 TMOUT=1
@ -21,7 +31,7 @@
TRAPALRM() { TRAPALRM() {
zle reset-prompt zle reset-prompt
} }
''; ''
}; );
}; };
} }