zshrc: Tools-Cheatsheet, fd/bat Aliases, Instant Prompt Fix

- tools() Funktion mit komplettem Cheat-Sheet aller Befehle
- fd/bat Kompatibilitaets-Aliases fuer Ubuntu (fdfind/batcat)
- POWERLEVEL9K_INSTANT_PROMPT=quiet vor den Source-Block verschoben
This commit is contained in:
Rene 2026-03-15 11:47:04 +01:00
parent 743709d4d8
commit 8f5d8f3e99

View file

@ -4,6 +4,8 @@
# ---------------------------------------------------------- # ----------------------------------------------------------
# 1) Powerlevel10k Instant Prompt (muss sehr weit oben stehen) # 1) Powerlevel10k Instant Prompt (muss sehr weit oben stehen)
# quiet: cowsay-Begruessung erzeugt Console-Output, Warnung unterdruecken
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi fi
@ -61,6 +63,10 @@ alias fetch="fastfetch"
alias gitsync="~/git-sync-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" alias mac-sync="curl -fsSL https://git.motocamp.de/rene/dotfiles-rene/raw/branch/main/bin/git-sync-all.sh | bash"
# Ubuntu-Kompatibilitaet: fd und bat heissen dort anders
command -v fdfind &>/dev/null && ! command -v fd &>/dev/null && alias fd='fdfind'
command -v batcat &>/dev/null && ! command -v bat &>/dev/null && alias bat='batcat'
# 7) History # 7) History
HISTFILE="$HOME/.zsh_history" HISTFILE="$HOME/.zsh_history"
HISTSIZE=5000 HISTSIZE=5000
@ -76,6 +82,84 @@ setopt AUTO_CD
precmd() { print -Pn "\e]0;%n@%m: %~\a" } precmd() { print -Pn "\e]0;%n@%m: %~\a" }
export COLORTERM=truecolor export COLORTERM=truecolor
# Cheat-Sheet: alle Tools, Aliases und Skripte auf einen Blick
tools() {
cat <<'TOOLS'
╔══════════════════════════════════════════════════════════════╗
║ Terminal Cheat-Sheet ║
╚══════════════════════════════════════════════════════════════╝
GIT
────────────────────────────────────────────────────────────────
gs git status
ga git add
gc git commit
gp git push
gl git log (oneline, graph)
gd git diff
gco git checkout
gb git branch
gitcheck Status aller Git-Repos pruefen
gitupdate alle Git-Repos pullen
gitsync alle Repos sync (push+pull)
mac-sync git-sync remote ausfuehren
PLATFORMIO
────────────────────────────────────────────────────────────────
pio run kompilieren
pio run -t upload flashen
pio device monitor seriellen Monitor oeffnen
pio run -t clean Build-Artefakte loeschen
pio lib install Bibliothek installieren
pio init --board <board> neues Projekt erstellen
NAVIGATION & DATEIEN
────────────────────────────────────────────────────────────────
z <pfad> zoxide: smart cd (lernt haeufige Pfade)
ll / la / l ls-Varianten (-lha / -A / -lh)
.. / ... / .... schnell hoch navigieren
eza modernes ls (Farben, Icons, Git-Status)
eza -la alle Dateien mit Details
eza -T Baumansicht
bat <datei> cat mit Syntax-Highlighting
fd <muster> schnelles find (z.B. fd '\.txt$')
rg <text> blitzschnelles grep (z.B. rg 'TODO' src/)
fzf Fuzzy-Finder (Ctrl+T Dateien, Ctrl+R History)
ncdu interaktive Festplattennutzung
duf schoene Uebersicht freier Speicherplatz
micro <datei> einfacher Editor (Ctrl+S, Ctrl+Q)
BILDER (~/bin)
────────────────────────────────────────────────────────────────
h2j / heic2jpg HEIC → JPG konvertieren
heic2jpg_resize + verkleinern
heic2jpg_delete + HEIC loeschen
heic2jpg_resize_delete + beides
jpg_resize nur JPG verkleinern
SYSTEM & KONFIG
────────────────────────────────────────────────────────────────
fetch fastfetch (Systeminfo)
cb Clipboard bereinigen (2 Leerzeichen weg)
zshconfig ~/.zshrc bearbeiten
p10kconfig ~/.p10k.zsh bearbeiten
tldr <befehl> Kurzanleitung mit Beispielen
MACBOOK-SETUP (curl | bash)
────────────────────────────────────────────────────────────────
setup-base.sh <13|16> Basis-Setup (als root)
setup-desktop.sh Desktop + Apps (als user)
SPASS
────────────────────────────────────────────────────────────────
cmatrix Matrix-Regen (q = quit)
asciiquarium Aquarium im Terminal (q = quit)
fortune | cowsay zufaelliger Spruch mit Kuh
TOOLS
}
# Terminal-Screensaver: zufaellig cmatrix oder asciiquarium nach 5 Min Idle # Terminal-Screensaver: zufaellig cmatrix oder asciiquarium nach 5 Min Idle
TMOUT=300 TMOUT=300
TRAPALRM() { TRAPALRM() {
@ -85,10 +169,8 @@ TRAPALRM() {
(( ${#screensavers[@]} )) && eval "${screensavers[$((RANDOM % ${#screensavers[@]} + 1))]}" (( ${#screensavers[@]} )) && eval "${screensavers[$((RANDOM % ${#screensavers[@]} + 1))]}"
} }
# 11) Begruessung: zufaellig Systemstatus, Spruch oder Witz # Begruessung: zufaellig Systemstatus, Spruch oder Witz
# (in exec-Block damit Powerlevel10k Instant Prompt nicht meckert)
if [[ -o interactive ]] && command -v cowsay &>/dev/null; then if [[ -o interactive ]] && command -v cowsay &>/dev/null; then
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
_greet() { _greet() {
local cow_files=(default tux sheep elephant dragon gnu koala) local cow_files=(default tux sheep elephant dragon gnu koala)
local cow="${cow_files[$((RANDOM % ${#cow_files[@]} + 1))]}" local cow="${cow_files[$((RANDOM % ${#cow_files[@]} + 1))]}"