313 lines
7.8 KiB
Markdown
313 lines
7.8 KiB
Markdown
# 🚀 Installation automatique de Zsh avec Powerlevel10k pour Debian 12
|
||
|
||
Script d'installation complet et idempotent pour configurer un environnement Zsh moderne et productif sur Debian 12.
|
||
|
||

|
||

|
||

|
||
|
||
## ✨ Fonctionnalités
|
||
|
||
Ce script installe et configure automatiquement :
|
||
|
||
- ✅ **Zsh** - Shell moderne et puissant
|
||
- ✅ **Oh My Zsh** - Framework de gestion de configuration
|
||
- ✅ **Powerlevel10k** - Thème ultra-rapide et personnalisable
|
||
- ✅ **Polices Nerd Fonts** (MesloLGS NF) - Pour un affichage parfait des icônes
|
||
- ✅ **Plugins essentiels** - Autocomplétion, coloration, historique amélioré
|
||
- ✅ **Outils modernes** - fzf, ripgrep, bat, exa, fd-find
|
||
|
||
## 📦 Plugins installés
|
||
|
||
### Plugins externes (via Git)
|
||
|
||
| Plugin | Description |
|
||
|--------|-------------|
|
||
| **zsh-autosuggestions** | Suggestions basées sur l'historique (→ pour accepter) |
|
||
| **zsh-syntax-highlighting** | Coloration syntaxique des commandes |
|
||
| **zsh-completions** | Autocompletions supplémentaires |
|
||
| **zsh-history-substring-search** | Recherche dans l'historique avec ↑/↓ |
|
||
| **fzf-tab** | Complétion interactive avec prévisualisation |
|
||
|
||
### Plugins Oh My Zsh intégrés
|
||
|
||
- `git` - Aliases Git (gs, ga, gc, gp, gl...)
|
||
- `docker` - Autocomplétion Docker
|
||
- `docker-compose` - Autocomplétion Docker Compose
|
||
- `sudo` - Double ESC pour préfixer avec sudo
|
||
- `history` - Gestion avancée de l'historique
|
||
- `colored-man-pages` - Pages man colorées
|
||
- `command-not-found` - Suggestions de paquets
|
||
|
||
## 🛠️ Outils supplémentaires
|
||
|
||
- **fzf** - Recherche floue interactive (Ctrl+R)
|
||
- **ripgrep** - Recherche ultra-rapide dans les fichiers
|
||
- **fd-find** - Alternative moderne à `find`
|
||
- **bat** - `cat` avec coloration syntaxique
|
||
- **exa** - `ls` amélioré avec icônes et couleurs
|
||
|
||
## 📋 Prérequis
|
||
|
||
- Debian 12 (Bookworm)
|
||
- Accès root ou sudo
|
||
- Connexion internet
|
||
|
||
## 🚀 Installation
|
||
|
||
### Installation rapide
|
||
|
||
```bash
|
||
# Télécharger le script
|
||
wget https://raw.giteausercontent.com/Johnny/Install_zsh/main/install_zsh.sh
|
||
|
||
# Rendre le script exécutable
|
||
chmod +x install_zsh.sh
|
||
|
||
# Exécuter pour l'utilisateur actuel
|
||
sudo ./install_zsh.sh
|
||
|
||
# Ou pour un utilisateur spécifique
|
||
sudo ./install_zsh.sh username
|
||
```
|
||
|
||
### Installation via Git
|
||
|
||
```bash
|
||
git clone https://git.h3campus.fr/Johnny/Install_zsh.git
|
||
cd Install_zsh
|
||
chmod +x install_zsh.sh
|
||
sudo ./install_zsh.sh
|
||
```
|
||
|
||
## ⚙️ Post-installation
|
||
|
||
1. **Déconnectez-vous et reconnectez-vous** pour activer Zsh
|
||
2. Au premier lancement, **l'assistant de configuration Powerlevel10k** se lance automatiquement
|
||
3. Suivez les instructions pour personnaliser votre prompt
|
||
|
||
### Reconfigurer Powerlevel10k
|
||
|
||
```bash
|
||
p10k configure
|
||
```
|
||
|
||
### Configuration SSH
|
||
|
||
Si vous utilisez SSH, configurez votre terminal local pour utiliser la police **MesloLGS NF** :
|
||
|
||
- **Windows Terminal** : Settings → Profiles → Defaults → Appearance → Font face → MesloLGS NF
|
||
- **iTerm2** : Preferences → Profiles → Text → Font → MesloLGS NF
|
||
- **VS Code** : Settings → Terminal › Integrated: Font Family → MesloLGS NF
|
||
|
||
## ⌨️ Raccourcis clavier
|
||
|
||
| Raccourci | Action |
|
||
|-----------|--------|
|
||
| `Ctrl + R` | Recherche floue dans l'historique (fzf) |
|
||
| `↑` / `↓` | Recherche dans l'historique (substring) |
|
||
| `→` | Accepter une suggestion |
|
||
| `ESC` `ESC` | Ajouter sudo à la commande |
|
||
| `Tab` | Complétion interactive avec prévisualisation |
|
||
|
||
## 🎨 Aliases inclus
|
||
|
||
### Général
|
||
```bash
|
||
ll # ls -lah avec exa si disponible
|
||
la # ls -A
|
||
tree # exa --tree (si exa installé)
|
||
cat # bat avec coloration (si bat installé)
|
||
```
|
||
|
||
### Git
|
||
```bash
|
||
gs # git status
|
||
ga # git add
|
||
gc # git commit
|
||
gp # git push
|
||
gl # git log --oneline --graph --decorate
|
||
```
|
||
|
||
### Docker
|
||
```bash
|
||
dps # docker ps
|
||
dpa # docker ps -a
|
||
di # docker images
|
||
dex # docker exec -it
|
||
```
|
||
|
||
### Maintenance
|
||
```bash
|
||
update-zsh # Mettre à jour Oh My Zsh et tous les plugins
|
||
zshconfig # Éditer ~/.zshrc
|
||
```
|
||
|
||
## 🔄 Mise à jour
|
||
|
||
Pour mettre à jour Oh My Zsh et tous les plugins :
|
||
|
||
```bash
|
||
update-zsh
|
||
```
|
||
|
||
Ou manuellement :
|
||
|
||
```bash
|
||
omz update
|
||
cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && git pull
|
||
cd ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && git pull
|
||
cd ~/.oh-my-zsh/custom/plugins/zsh-completions && git pull
|
||
cd ~/.oh-my-zsh/custom/plugins/fzf-tab && git pull
|
||
cd ~/.oh-my-zsh/custom/themes/powerlevel10k && git pull
|
||
```
|
||
|
||
## 💾 Sauvegarde de la configuration
|
||
|
||
### Sauvegarder Powerlevel10k
|
||
|
||
```bash
|
||
# Sauvegarde locale
|
||
cp ~/.p10k.zsh ~/.p10k.zsh.backup
|
||
|
||
# Sauvegarde datée
|
||
cp ~/.p10k.zsh ~/p10k-backup-$(date +%Y%m%d).zsh
|
||
```
|
||
|
||
### Sauvegarder .zshrc
|
||
|
||
```bash
|
||
cp ~/.zshrc ~/.zshrc.backup
|
||
```
|
||
|
||
### Synchroniser entre serveurs
|
||
|
||
```bash
|
||
# Depuis le serveur source
|
||
scp ~/.p10k.zsh ~/.zshrc user@serveur-destination:~/
|
||
|
||
# Ou avec Git (recommandé)
|
||
mkdir -p ~/dotfiles
|
||
cp ~/.p10k.zsh ~/.zshrc ~/dotfiles/
|
||
cd ~/dotfiles
|
||
git init
|
||
git add .
|
||
git commit -m "Initial dotfiles"
|
||
git remote add origin https://github.com/USERNAME/dotfiles.git
|
||
git push -u origin main
|
||
```
|
||
|
||
## 🔧 Personnalisation
|
||
|
||
### Modifier les plugins
|
||
|
||
Éditez `~/.zshrc` et modifiez la section `plugins=()` :
|
||
|
||
```bash
|
||
plugins=(
|
||
git
|
||
docker
|
||
# Ajoutez vos plugins ici
|
||
)
|
||
```
|
||
|
||
### Ajouter des aliases personnalisés
|
||
|
||
Ajoutez vos aliases à la fin de `~/.zshrc` :
|
||
|
||
```bash
|
||
alias mon-alias='ma-commande'
|
||
```
|
||
|
||
Puis rechargez :
|
||
|
||
```bash
|
||
source ~/.zshrc
|
||
# ou
|
||
exec zsh
|
||
```
|
||
|
||
## 🐛 Dépannage
|
||
|
||
### Les icônes ne s'affichent pas correctement
|
||
|
||
- Vérifiez que votre terminal utilise la police **MesloLGS NF**
|
||
- Redémarrez votre terminal après avoir changé la police
|
||
|
||
### Zsh n'est pas le shell par défaut
|
||
|
||
```bash
|
||
# Vérifier le shell actuel
|
||
echo $SHELL
|
||
|
||
# Changer manuellement
|
||
chsh -s $(which zsh)
|
||
```
|
||
|
||
### Les suggestions sont lentes
|
||
|
||
Ajoutez dans `~/.zshrc` :
|
||
|
||
```bash
|
||
ZSH_AUTOSUGGEST_USE_ASYNC=true
|
||
```
|
||
|
||
### Désactiver un plugin
|
||
|
||
Éditez `~/.zshrc` et retirez le plugin de la liste, puis :
|
||
|
||
```bash
|
||
source ~/.zshrc
|
||
```
|
||
|
||
## 📝 Structure des fichiers
|
||
|
||
```
|
||
~/
|
||
├── .zshrc # Configuration principale Zsh
|
||
├── .p10k.zsh # Configuration Powerlevel10k
|
||
├── .oh-my-zsh/ # Framework Oh My Zsh
|
||
│ └── custom/
|
||
│ ├── plugins/ # Plugins personnalisés
|
||
│ │ ├── zsh-autosuggestions/
|
||
│ │ ├── zsh-syntax-highlighting/
|
||
│ │ ├── zsh-completions/
|
||
│ │ ├── zsh-history-substring-search/
|
||
│ │ └── fzf-tab/
|
||
│ └── themes/
|
||
│ └── powerlevel10k/ # Thème Powerlevel10k
|
||
└── .local/share/fonts/ # Polices MesloLGS NF
|
||
```
|
||
|
||
## 🤝 Contribution
|
||
|
||
Les contributions sont les bienvenues ! N'hésitez pas à :
|
||
|
||
1. Fork le projet
|
||
2. Créer une branche (`git checkout -b feature/amelioration`)
|
||
3. Commit vos changements (`git commit -m 'Ajout fonctionnalité'`)
|
||
4. Push vers la branche (`git push origin feature/amelioration`)
|
||
5. Ouvrir une Pull Request
|
||
|
||
## 📜 Licence
|
||
|
||
Ce projet est sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus de détails.
|
||
|
||
## 🙏 Remerciements
|
||
|
||
- [Oh My Zsh](https://ohmyz.sh/)
|
||
- [Powerlevel10k](https://github.com/romkatv/powerlevel10k)
|
||
- [zsh-users](https://github.com/zsh-users) pour les plugins
|
||
- [Aloxaf](https://github.com/Aloxaf/fzf-tab) pour fzf-tab
|
||
|
||
## 📧 Support
|
||
|
||
Si vous rencontrez des problèmes ou avez des questions :
|
||
|
||
- Ouvrez une [issue](https://git.h3campus.fr/Johnny/Install_zsh/issues)
|
||
- Consultez la [documentation Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh/wiki)
|
||
- Consultez la [documentation Powerlevel10k](https://github.com/romkatv/powerlevel10k)
|
||
|
||
|
||
|
||
Made with ❤️ for the Zsh community |