config: improve zsh bootstrapping

This commit is contained in:
xeruf 2023-01-18 02:02:35 +01:00
parent e386d2ba04
commit b71d05327a
3 changed files with 46 additions and 7 deletions

View File

@ -0,0 +1,24 @@
command_not_found_handler() {
local pkgs cmd="$1"
pkgs=(${(f)"$(pkgfile -b -v -- "$cmd" 2>/dev/null)"})
if [[ -n "$pkgs" ]]; then
printf 'The application %s is not installed. It may be found in the following packages:\n' "$cmd"
printf ' %s\n' $pkgs[@]
setopt shwordsplit
pkg_array=($pkgs[@])
pkgname="${${(@s:/:)pkg_array}[2]}"
printf 'Do you want to Install package %s? (y/N) ' $pkgname
if read -q "choice? "; then
echo
echo "Executing command: pamac install $pkgname"
pamac install $pkgname
else
echo " "
fi
else
printf 'zsh: command not found: %s\n' "$cmd"
fi 1>&2
return 127
}

View File

@ -27,13 +27,26 @@ ExecStart=-$agetty --skip-login --login-options $USER %I" |
sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf /etc/systemd/system/getty@tty2.service.d/override.conf /etc/systemd/system/getty@tty3.service.d/override.conf
highlight "Sysyadm setup"
if test -d "/etc/yadm"
if test -d "/etc/yadm/repo.git/"
then sy l
else sy clone
else echo "" | sy clone
fi
SECTION "Software"
highlight "Cleanup Manjaro Sway Dotfiles"
rmexist() {
for arg
do test -e "$arg" && echo -n "$arg: " && rm -rI "$arg"
done
}
rmexist "$XDG_CONFIG_HOME/nvim/init.lua" "$HOME/.emacs.d/"
highlight "MPD"
mkdir "${XDG_STATE_HOME}/mpd"
sudo systemctl enable --now mpd
mpc update
template() {
local dir=$(dirname "$1")
local file=${1/.template}
@ -76,10 +89,13 @@ test -d "$_ovpn" &&
sudo chown -vR janek:openvpn "$_ovpn"
highlight "Cron"
sudo systemctl enable --now cronie
if test -d "/etc/rsyslog.d"; then
echo 'cron.* /var/log/cron.log' | sudo tee /etc/rsyslog.d/60-cron.conf
hasService=$(which service 2>/dev/null)
test "$hasService" && sudo service rsyslog restart || sudo systemctl restart rsyslog
test "$hasService" && sudo service cron reload || sudo systemctl reload cronie
fi
highlight "Zsh"
test -n "$ZSH" || export ZSH="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/oh-my-zsh"

View File

@ -187,7 +187,6 @@ source_existing() {
done
}
source_existing /usr/share/zsh/manjaro-zsh-config
source_existing $CONFIG_ZSH/.p10k.zsh # To customize prompt, run `p10k configure` or edit .p10k.zsh.
source_existing /usr/share/fzf/key-bindings.zsh /usr/share/fzf/completion.zsh