Added OMP to .zshrc

This commit is contained in:
pauljako 2024-08-23 17:32:03 +02:00
parent 48a1b496d3
commit ce41d504c3

31
.zshrc
View file

@ -2,3 +2,34 @@
#
# Colored ls
alias ls=ls --color=auto
#
# Detect Device Arch
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
case "${arch}" in
x86_64) arch="amd64" ;;
armv*) arch="arm" ;;
arm64) arch="arm64" ;;
aarch64) arch="arm64" ;;
i686) arch="386" ;;
esac
if [ "${arch}" = "arm64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
arch=arm
fi
#
# Detect Device Platform
platform="$(uname -s | awk '{print tolower($0)}')"
case "${platform}" in
linux) platform="linux" ;;
darwin) platform="darwin" ;;
esac
#
# Get and download the correct OMP
correct_omp="~/.config/oh-my-posh/posh-$platform-$arch"
if [ ! -f "$correct_omp" ]; then
echo "Downloading Oh My Posh for $platform-$arch"
curl -s -o "$correct_omp" "https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/latest/posh-$platform-$arch"
fi
alias oh-my-posh="$correct_omp"