166 lines
5.5 KiB
Markdown
166 lines
5.5 KiB
Markdown
# 🚀 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.
|