feat: autoinstall for powerline10K and zsh-autosugestions

This commit is contained in:
Ward Truyen
2025-12-08 21:22:24 +01:00
parent b1f9ed538a
commit 6a541438ee

34
.zshrc
View File

@@ -1,3 +1,10 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Lines configured by zsh-newuser-install # Lines configured by zsh-newuser-install
HISTFILE=~/.histfile HISTFILE=~/.histfile
HISTSIZE=1000 HISTSIZE=1000
@@ -11,9 +18,6 @@ autoload -Uz compinit
compinit compinit
# End of lines added by compinstall # End of lines added by compinstall
eval "$(oh-my-posh init zsh)"
# personal aliases # personal aliases
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias la='ls -a' alias la='ls -a'
@@ -26,3 +30,27 @@ alias ..='cd ..'
# Java home # Java home
export JAVA_HOME=/usr/lib/jvm/default export JAVA_HOME=/usr/lib/jvm/default
# Plugin idea copy from https://github.com/KulkarniKaustubh/dotfiles/blob/main/zsh/.plugins.zsh
# check if ~/.zsh exists
if [ ! -d "$HOME/.zsh" ]; then
echo "Creating a .zsh folder in $HOME"
echo "This can be copied elsewhere and then linked, preferrably using GNU stow"
mkdir $HOME/.zsh
fi
# check if p10k exists
if [ ! -d "$HOME/.zsh/powerlevel10k" ]; then
echo "Installing powerelevel10k theme."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $HOME/.zsh/powerlevel10k
fi
source $HOME/.zsh/powerlevel10k/powerlevel10k.zsh-theme
# check if zsh autosuggest exists
if [ ! -d "$HOME/.zsh/zsh-autosuggestions" ]; then
echo "Installing zsh autosuggestions."
git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.zsh/zsh-autosuggestions
fi
source $HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh