logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).


L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT → ODT PDF Export

Ceci est une ancienne révision du document !


zsh - ohmyzsh - Powerlevel10k

Introduction

Amélioration du shell zsh avec ohmyzsh et powerlevel10k, coloration syntaxique, suggestions des commandes depuis l'historique …

Installation

Paquets Nécessaire :

apt update && apt install fonts-powerline git curl zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
--info 'Do you want to change your default shell to zsh? [Y/n]' Y, Enter
--info 'Mot de passe :' Mot de passe utilisateur (sudoers?), Enter

Optionnel (dépends de la section configuration) :

Un thème sympathique :

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Prédiction basé sur les commandes contenu dans le .zsh_history :

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

Coloration Syntaxique :

git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

Configuration

nano ~/.zshrc

-Ajouter ceci en première ligne :

export TERM="xterm-256color"

-Cherchez : ZSH_THEME=“robbyrussell” et remplacer par :

ZSH_THEME="powerlevel9k/powerlevel9k"

-Idem avec : plugins=(git) :

plugins=(
        zsh-autosuggestions
        zsh-syntax-highlighting
        colored-man-pages
        git
        )

-Puis à la fin de votre fichier pour un laptop :

POWERLEVEL9K_CUSTOM_DEBIAN_ICON="echo -e '\uf306' "
POWERLEVEL9K_CUSTOM_DEBIAN_ICON_BACKGROUND=233
POWERLEVEL9K_CUSTOM_DEBIAN_ICON_FOREGROUND=010

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_debian_icon root_indicator dir dir_writable)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time battery)

POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="\u256d\u2500 "
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="\u2570\ue0c0 "

POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

POWERLEVEL9K_TIME_FORMAT="%D{\ue383 %H:%M \uf073 %d.%m.%y}"

POWERLEVEL9K_BATTERY_CHARGING='yellow'
POWERLEVEL9K_BATTERY_CHARGED='green'
POWERLEVEL9K_BATTERY_DISCONNECTED='$DEFAULT_COLOR'
POWERLEVEL9K_BATTERY_LOW_THRESHOLD='10'
POWERLEVEL9K_BATTERY_LOW_COLOR='red'
POWERLEVEL9K_BATTERY_ICON='\uf1e6 '

-Puis à la fin de votre fichier pour un desktop :

POWERLEVEL9K_CUSTOM_DEBIAN_ICON="echo -e '\uf306' "
POWERLEVEL9K_CUSTOM_DEBIAN_ICON_BACKGROUND=233
POWERLEVEL9K_CUSTOM_DEBIAN_ICON_FOREGROUND=010

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_debian_icon root_indicator dir dir_writable)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time)

POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="\u256d\u2500 "
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="\u2570\ue0c0 "

POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

POWERLEVEL9K_TIME_FORMAT="%D{\ue383 %H:%M \uf073 %d.%m.%y}"

-Prise en charge des glyphe :

wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/Hack.zip
mkdir hack
unzip Hack.zip -d hack
mv hack /usr/share/fonts/truetype/
fc-cache -f -v
Pensez à modifier la police par défaut de votre terminal !

Astuce

–Selon votre distrib ou vos envies, vous pouvez personnaliser le logo (custom_debian_icon) en récupérant le code ici : https://www.nerdfonts.com/cheat-sheet Une fois fait, ajoutez après '\u' votre code donc par exemple pour ubuntu remplacer le '\uf306' (debian) si dessus par '\ufa47' (ubuntu)

–Avec les deux lignes suivant custom_debian_icon vous avez background et foreground, à personnaliser avec la commande suivante dans un shell zsh :

for code ({000..255}) print -P -- "$code:%F{$code}Couleur : \uf445\uf445\uf445"

Choisissez un nombre correspondant à la couleur de votre choix et changez la valeurs des lignes POWERLEVEL9K indiqué plus haut.

Prise en compte des modifications .zshrc :

source ~/.zshrc
utilisateurs/kawer/tutos/ohmyzsh.1642956595.txt.gz · Dernière modification: 23/01/2022 17:49 par kawer

Pied de page des forums

Propulsé par FluxBB