diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..8a0f403 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,75 @@ +# ---------------------------------------------------------- +# Zsh-Konfiguration fuer Rene (Linux / MacBook Pro) +# Oh My Zsh + Powerlevel10k + Micro +# ---------------------------------------------------------- + +# 1) Powerlevel10k Instant Prompt (muss sehr weit oben stehen) +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 + +# 2) Oh My Zsh Basis +export ZSH="$HOME/.oh-my-zsh" +ZSH_THEME="powerlevel10k/powerlevel10k" + +plugins=( + git + zsh-syntax-highlighting + zoxide +) + +source "$ZSH/oh-my-zsh.sh" + +# 3) Powerlevel10k-Konfiguration +[[ -f "$HOME/.p10k.zsh" ]] && source "$HOME/.p10k.zsh" + +# 4) Standard-Editor (lokal: micro, SSH: nicht erzwingen) +if [[ -z "$SSH_CONNECTION" ]]; then + export EDITOR="micro" + export VISUAL="micro" +fi + +# 5) Pfade +export PATH="$HOME/bin:$HOME/.local/bin:$HOME/.npm-global/bin:$PATH" + +# 6) Aliases + +# ls-Varianten +alias ll='ls -lha' +alias la='ls -A' +alias l='ls -lh' + +# Verzeichnisse +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' + +# Konfigdateien +alias zshconfig='micro ~/.zshrc' +alias p10kconfig='micro ~/.p10k.zsh' + +# Git-Kurzbefehle +alias gs='git status' +alias ga='git add' +alias gc='git commit' +alias gp='git push' +alias gl='git log --oneline --graph --decorate' +alias gitcheck="~/git-check-all.sh --short" +alias gitupdate="~/git-update-all.sh" +alias gitsync="~/git-sync-all.sh" +alias mac-sync="curl -fsSL https://git.motocamp.de/rene/dotfiles-rene/raw/branch/main/bin/git-sync-all.sh | bash" + +# 7) History +HISTFILE="$HOME/.zsh_history" +HISTSIZE=5000 +SAVEHIST=5000 +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_SPACE +setopt SHARE_HISTORY + +# 8) Zsh-Optionen +setopt AUTO_CD + +# 9) Fenster-/Tab-Titel +precmd() { print -Pn "\e]0;%n@%m: %~\a" } +export COLORTERM=truecolor diff --git a/zsh/install-zsh-dotfiles.sh b/zsh/install-zsh-dotfiles.sh new file mode 100755 index 0000000..3c2a9b0 --- /dev/null +++ b/zsh/install-zsh-dotfiles.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Zsh Dotfiles Installer +# Erstellt Symlink ~/.zshrc -> dotfiles-rene/zsh/.zshrc + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ZSHRC_SOURCE="$SCRIPT_DIR/.zshrc" +ZSHRC_TARGET="$HOME/.zshrc" + +echo "=== Zsh Dotfiles Installer ===" + +# Backup falls .zshrc existiert und kein Symlink ist +if [ -e "$ZSHRC_TARGET" ] && [ ! -L "$ZSHRC_TARGET" ]; then + local_backup="$ZSHRC_TARGET.bak.$(date +%Y%m%d%H%M%S)" + echo "Bestehende .zshrc gefunden, erstelle Backup: $local_backup" + mv "$ZSHRC_TARGET" "$local_backup" +fi + +# Entferne alten Symlink falls vorhanden +if [ -L "$ZSHRC_TARGET" ]; then + echo "Entferne alten Symlink..." + rm "$ZSHRC_TARGET" +fi + +# Symlink erstellen +echo "Erstelle Symlink: $ZSHRC_TARGET -> $ZSHRC_SOURCE" +ln -s "$ZSHRC_SOURCE" "$ZSHRC_TARGET" + +echo "=== Zsh Dotfiles installiert ==="