Files
ultimate-zsh-setup/README.md

5.3 KiB

🚀 Ultimate Zsh Terminal Setup (WSL/Linux)

Guida completa per trasformare il terminale da "blu illeggibile" a una dashboard spaziale con icone, colori neon e info di sistema.

📸 Anteprima

  • Tema: Powerlevel10k (con Instant Prompt disabilitato per compatibilità)
  • Icone: LSD (LSDeluxe) al posto di ls
  • Info: Neofetch all'avvio
  • Font: MesloLGS NF (Nerd Font)

1. 📦 Installazione Requisiti (WSL/Ubuntu)

Esegui questi comandi per installare i tool grafici necessari:

# Aggiorna i pacchetti
sudo apt update

# Installa Neofetch (Info sistema)
sudo apt install neofetch -y

# Installa LSD (Icone colorate per i file)
sudo apt install lsd -y

# Installa Oh My Zsh (se non lo hai già)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Installa il tema Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

2. 🔤 Installazione Font (Su Windows)

Passaggio CRUCIALE: Senza questo vedrai dei rettangoli o punti di domanda ? al posto delle icone.

Scarica questi 4 file .ttf:

  1. Vai nella cartella Download di Windows, selezionali tutti, tasto destro -> Installa.
  2. Apri Windows Terminal -> Impostazioni (o CTRL + ,).
  3. Seleziona il profilo (es. Ubuntu) -> Aspetto -> Carattere.
  4. Scegli MesloLGS NF.
  5. Salva.

3. ⚙️ Configurazione .zshrc

Copia questo contenuto e incollalo nel tuo file ~/.zshrc (nano ~/.zshrc):

# =============================================================================
# P10K INSTANT PROMPT
# Impostato su 'off' per evitare conflitti con Neofetch su WSL
# =============================================================================
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
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

# =============================================================================
# ZSH MAIN CONFIGURATION
# =============================================================================
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"

# Plugin suggeriti
plugins=(git command-not-found common-aliases history-substring-search)

source $ZSH/oh-my-zsh.sh

# =============================================================================
# HISTORY & KEYBINDINGS
# =============================================================================
setopt histignorealldups sharehistory
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
bindkey -e

# =============================================================================
# COMPLETION SYSTEM (Avanzato)
# =============================================================================
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2

# Colori custom per fallback
export LS_COLORS="di=1;36:ln=1;35:so=1;32:pi=1;33:ex=1;32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

# =============================================================================
# ALIAS & GRAFICA (LSD + Neofetch)
# =============================================================================
# Usa LSD se installato, altrimenti ls colorato
if (( $+commands[lsd] )); then
    alias ls='lsd'
    alias ll='lsd -alF'
    alias la='lsd -A'
    alias l='lsd -CF'
    alias tree='lsd --tree'
else
    alias ls='ls --color=auto'
    alias ll='ls -alF --color=auto'
    alias la='ls -A --color=auto'
    alias l='ls -CF --color=auto'
fi
alias grep='grep --color=auto'

# =============================================================================
# STARTUP
# =============================================================================
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
neofetch

4. 🎨 Finalizzare il Setup

Per configurare la barra (colori, forme, orario):

p10k configure

Rispondi Yes (y) a tutte le domande sulle icone (Diamante, Lucchetto, ecc.) per confermare che il font funziona.


Salvalo come setup-terminale.md e hai fatto. Alla prossima! 🤙