From 7aa91defab8027e7d002bb42b620b5268d5a3cc6 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 12 Oct 2025 14:24:03 -0400 Subject: [PATCH] Install zsh-histclean alongside zsh --- applications.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/applications.go b/applications.go index b16762b..1266eb5 100644 --- a/applications.go +++ b/applications.go @@ -27,6 +27,7 @@ func applications() { case 4: managePackages("-S", []string{"zsh", "zsh-autosuggestions", "zsh-syntax-highlighting"}) writeFile(mountPoint+"/home/"+getUsername()+"/.zshrc", zshrc, getUsername(), 0644) + writeFile(mountPoint+"/usr/local/bin/histclean", zshHistclean, "root", 0755) err := os.RemoveAll(mountPoint + "/home/" + getUsername() + "/.bash_profile") if err != nil { other.PrintError("Failed to remove .bash_profile", 1) @@ -141,6 +142,31 @@ alias unmv='setopt shwordsplit && lastCmdSplit=(${(@s/ /)$(fc -ln -1)}) && newCm alias orphans='doas pacman -Rcns $(pacman -Qqdt)' ` +const zshHistclean = `#!/usr/bin/env zsh + +echo 'Starting history size:' +ls -lh ~/.cache/zsh-histfile | cut -d " " -f5 + +hist=() + +while IFS= read -r line; do + if [[ $line == "./"* || $line == "/"* ]]; then + hist+=($line) + elif [[ $line != "histclean" ]]; then + which $(echo $line | cut -d " " -f1) > /dev/null + [[ $? == 0 ]] && hist+=($line) + fi +done < "$XDG_CACHE_HOME"/zsh-histfile + +echo -n "" > "$XDG_CACHE_HOME"/zsh-histfile +for item in "${hist[@]}"; do + echo "$item" >> "$XDG_CACHE_HOME"/zsh-histfile +done + +echo 'Ending history size:' +ls -lh ~/.cache/zsh-histfile | cut -d " " -f5 +` + const sysinitVim = `" rwinkhart/cachyos-postinstall-helper 09/28/2025 " ensure correct basic settings