Starship/README.md
2025-08-29 00:59:37 +02:00

5.5 KiB
Raw Blame History

🚀 Configuration Starship (Windows & Linux)

Ce dépôt contient un fichier starship.toml prêt à lemploi pour personnaliser votre terminal avec Starship.


📥 Installation de Starship

🔹 Windows

  1. Installer Starship via winget :

    winget install --id Starship.Starship -e
    
  2. Activer Starship dans PowerShell :

    • Ouvrir le profil PowerShell :

      notepad $PROFILE
      
    • Coller le bloc suivant puis enregistrer :

      # Ouvrir/éditer le profil :
      # notepad $PROFILE
      # --- Qualité de vie ---
      [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()
      Import-Module PSReadLine -ErrorAction SilentlyContinue
      Set-PSReadLineOption -PredictionSource History
      Set-PSReadLineOption -EditMode Windows
      
      # --- Starship ---
      Invoke-Expression (& starship init powershell)
      
      # =======================
      # Aliases / Fonctions
      # =======================
      
      # e. -> ouvrir l'explorateur dans le dossier courant
      function e { param($path='.') Start-Process explorer $path }
      Set-Alias e. e  # si ça gêne, supprime cette ligne et appelle simplement `e`
      
      # glog -> git log joli + args pass-through
      function glog { git log --oneline --all --graph --decorate @args }
      
      # ls -> déjà alias de Get-ChildItem en PS ; variantes utiles :
      function ll { Get-ChildItem -Force }
      function la { Get-ChildItem -Force -Hidden }
      
      # clear -> nettoyer l'écran
      Set-Alias clear Clear-Host
      
      # up / down -> docker compose
      function up   { docker compose up -d   @args }
      function down { docker compose down    @args }
      
      # run -> serveur PHP local
      function run  { php -S localhost:80    @args }
      
      # term -> shell dans le conteneur `php-web`
      function term { docker exec -it php-web bash @args }
      
      # tests -> PHPUnit
      function tests { & 'vendor\bin\phpunit' 'tests\' --colors=always --testdox @args }
      

    📋 Liste des alias et fonctions ajoutées

    Alias / Fonction Commande associée Description
    e. explorer . Ouvre lexplorateur Windows dans le dossier courant
    glog git log --oneline --all --graph --decorate Historique Git compact et lisible
    ll Get-ChildItem -Force Liste fichiers, y compris cachés
    la Get-ChildItem -Force -Hidden Liste tous les fichiers, même cachés et système
    clear Clear-Host Nettoie lécran du terminal
    up docker compose up -d Lance Docker Compose en arrière-plan
    down docker compose down Arrête les conteneurs Docker
    run php -S localhost:80 Démarre un serveur PHP local
    term docker exec -it php-web bash Shell dans le conteneur php-web
    tests vendor\bin\phpunit tests\ --colors=always --testdox Exécute PHPUnit avec sortie lisible
  3. Relancer Windows Terminal.


🔹 Linux (Ubuntu / Debian / autres distros)

  1. Installer Starship :

    • Script officiel (toutes distros) :

      curl -sS https://starship.rs/install.sh | sh
      
    • Ou via gestionnaire de paquets si disponible :

      # Debian/Ubuntu
      sudo apt install starship -y
      
      # Fedora
      sudo dnf install starship -y
      
      # Arch
      sudo pacman -S starship
      
  2. Activer Starship dans votre shell :

    • Bash (~/.bashrc) :
      eval "$(starship init bash)"
      
    • Zsh (~/.zshrc) :
      eval "$(starship init zsh)"
      
    • Fish (~/.config/fish/config.fish) :
      starship init fish | source
      
  3. Relancer le shell.


⚙️ Télécharger et copier le fichier starship.toml

Au lieu de copier manuellement, vous pouvez directement récupérer le fichier avec :

Linux / WSL

curl -fsSL https://git.eldunar.fr/TonyLight/Starship.git/raw/branch/main/starship.toml -o ~/.config/starship.toml

ou

wget -O ~/.config/starship.toml https://git.eldunar.fr/TonyLight/Starship.git/raw/branch/main/starship.toml

Windows PowerShell

iwr -useb https://git.eldunar.fr/TonyLight/Starship.git/raw/branch/main/starship.toml | Out-File -Encoding utf8 "$env:USERPROFILE\.config\starship.toml"

🔡 Police recommandée

Pour afficher correctement les icônes et glyphes Nerd Fonts, installez : DejaVu Sans Mono Nerd Font


Une fois ces étapes suivies, relancez votre terminal → vous aurez un prompt stylisé et homogène entre Windows et Linux.