Install zsh-histclean alongside zsh

This commit is contained in:
2025-10-12 14:24:03 -04:00
parent 0c010f0904
commit 7aa91defab
+26
View File
@@ -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