commit 51cac587e2a0a4779cc73b225a5c57d2f502e873 Author: Tony Light Date: Fri Aug 29 00:59:37 2025 +0200 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..0135f38 --- /dev/null +++ b/README.md @@ -0,0 +1,165 @@ +# 🚀 Configuration Starship (Windows & Linux) + +Ce dépôt contient un fichier `starship.toml` prêt à l’emploi pour personnaliser votre terminal avec [Starship](https://starship.rs/). + +--- + +## 📥 Installation de Starship + +### 🔹 Windows + +1. **Installer Starship via winget :** + + ```powershell + winget install --id Starship.Starship -e + ``` + +2. **Activer Starship dans PowerShell :** + + - Ouvrir le profil PowerShell : + ```powershell + notepad $PROFILE + ``` + - Coller le bloc suivant puis enregistrer : + + ```powershell + # 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 l’explorateur 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) : + ```bash + curl -sS https://starship.rs/install.sh | sh + ``` + - Ou via gestionnaire de paquets si disponible : + + ```bash + # 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`) : + ```bash + eval "$(starship init bash)" + ``` + - **Zsh** (`~/.zshrc`) : + ```bash + eval "$(starship init zsh)" + ``` + - **Fish** (`~/.config/fish/config.fish`) : + ```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 + +```bash +curl -fsSL https://git.eldunar.fr/TonyLight/Starship.git/raw/branch/main/starship.toml -o ~/.config/starship.toml +``` + +ou + +```bash +wget -O ~/.config/starship.toml https://git.eldunar.fr/TonyLight/Starship.git/raw/branch/main/starship.toml +``` + +### Windows PowerShell + +```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** + +- Téléchargement : https://www.nerdfonts.com/font-downloads +- Après installation, sélectionnez la police dans votre terminal (Windows Terminal, Alacritty, Kitty, etc.) : + ```text + DejaVuSansMono Nerd Font + ``` + +--- + +✅ Une fois ces étapes suivies, relancez votre terminal → vous aurez un prompt stylisé et homogène entre Windows et Linux. diff --git a/starship.toml b/starship.toml new file mode 100644 index 0000000..2771cb7 --- /dev/null +++ b/starship.toml @@ -0,0 +1,96 @@ + +# # Get editor completions based on the config schema +"$schema" = 'https://starship.rs/config-schema.json' + +# Rendre Docker & co plus tolérant sur Windows +command_timeout = 2000 # 2s pour laisser le temps à docker.exe de répondre +scan_timeout = 100 # 100ms pour détecter les fichiers dans le dossier + + +add_newline = true + +format = """$time $all""" + +[character] +success_symbol = "[➜](white)" +error_symbol = "[➜](white)" + +[git_branch] +symbol = " " +truncation_length = 4 +truncation_symbol = "" +# ignore_branches = ["master", "main"] +format = "[](fg:#ffffff bg:none)[](fg:#282c34 bg:#ffffff)[](fg:#ffffff bg:#24c90a)[ $branch]($style)[](fg:#24c90a bg:none) " +style = "fg:#ffffff bg:#24c90a" + +[git_commit] +commit_hash_length = 4 +tag_symbol = "🔖 " +format = "[\\($hash\\)]($style) [\\($tag\\)]($style)" +style = "green" + +[git_status] +format = "[](fg:#ffffff bg:none)[🥶](fg:#282c34 bg:#ffffff)[ ](fg:#ffffff bg:#4da0ff)[$modified](fg:#282c34 bg:#4da0ff)[$untracked](fg:#282c34 bg:#4da0ff)[$staged](fg:#282c34 bg:#4da0ff)[$renamed](fg:#282c34 bg:#4da0ff)[](fg:#4da0ff bg:none)" +conflicted = "" +ahead = "🏎💨" +behind = "😰" +diverged = "😵" +up_to_date = "🥰" +untracked = "🤷" +stashed = "📦" +modified = "📝" +renamed = "👅" +deleted = "🗑️" +style = "red" +disabled = true + +# [git_state] +# rebase = "REBASING" +# merge = "MERGING" +# revert = "REVERTING" +# cherry_pick = "CHERRY-PICKING" +# bisect = "BISECTING" +# am = "AM" +# am_or_rebase = "AM/REBASE" +# style = "yellow" +# format = '\([$state( $progress_current/$progress_total)]($style)\) ' +# disabled = true + + +[directory] +format = "[](fg:#ffffff bg:none)[✨](fg:#ffffff bg:#ffffff)[](fg:#ffffff bg:#ffc32b)[ $path]($style)[](fg:#ffc32b bg:none) " +style = "fg:#222222 bg:#ffc32b" +truncation_length = 3 +truncate_to_repo = false +home_symbol = "" + +[python] +format = "[](fg:#ffffff bg:none)[🐍](fg:#ffffff bg:#ffffff)[](fg:#ffffff bg:#2eb82e)[ (${version} )(\\($virtualenv\\))](fg:#ffffff bg:#2eb82e)[](fg:#2eb82e bg:none) " + + +[time] +disabled = false +format = "[](fg:#ffffff bg:none)[🕒](fg:#ffffff bg:#ffffff)[](fg:#ffffff bg:#f72851)[ $time](fg:#ffffff bg:#f72851)[](fg:#f72851 bg:none)" +time_format = "%R" #change to %R to only have HH:MM +style = "fg:#000000 bg:#f72851" + + +[cmd_duration] +min_time = 1000 +format = "[](fg:#ffffff bg:none)[🚨](fg:#ffffff bg:#ffffff)[](fg:#ffffff bg:#e60000)[ Durée : $duration](fg:#ffffff bg:#e60000)[](fg:#e60000 bg:none)" + +[docker_context] +only_with_files = true +symbol = "🐳 " +style = "fg:#3DA2FF" # bright blue, tweak to taste +format = "[](fg:#3DA2FF bg:none)[$symbol$context]($style)[](fg:#3DA2FF bg:none) " + +[kubernetes] +disabled = false # the module is off by default +symbol = "🕸️" +style = "fg:#A8B9FE" # kube-blue +format = "[](fg:#A8B9FE bg:none)[$symbol$context(/$namespace)]($style)[](fg:#A8B9FE bg:none) " + +# [[kubernetes.contexts]] +# context_pattern = "colima" # local Colima cluster +# style = "fg:#3DA2FF"