====== Installer oh-my-zsh ======
* [[/Article/|Les articles]]
* [[/Contact/]]
Largement inspiré de
https://aymeric-cucherousset.fr/installer-zsh-sur-debian-11/
https://gist.github.com/n1snt/454b879b8f0b7995740ae04c5fb5b7df
**oh-my-zsh** est un complément fort utile pour l'environnement **zsh**
[ "$USER" = "root" ] && apt -y update && apt -y install git curl zsh fonts-powerline unzip
bash -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
export ZSH="$HOME/.oh-my-zsh"
# autosuggesions plugin
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH/plugins/zsh-autosuggestions
# zsh-syntax-highlighting plugin
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/plugins/zsh-syntax-highlighting
# zsh-history-substring-search plugin
git clone https://github.com/zsh-users/zsh-history-substring-search $ZSH/custom/plugins/zsh-history-substring-search
# zsh-autocomplete plugin
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git $ZSH/plugins/zsh-autocomplete
Activer les plugins en adaptant .zshrc
# Trouver
plugins=(git)
# Remplacer par
plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search zsh-autocomplete)
Exemple de contenu style "titux" du fichier .zshrc
* ! Attention !\\
Le code suivant permet de créer le fichier .**zshtc** pour configurer **zsh** si ce fichier **~/.zshrc** n'existe pas déjà ...
[ -e ~/.zshrc ] && {
echo "Le fichier ~/.zshrc existe donc pas de création de ce fichier...
Si vous souhaitez le suppimmer passez la commande : rm ~/.zshrc"
} || {
cat << EOF >~/.zshrc
##----------------------------------------------------------------------------------
echo $PATH|grep $HOME/bin: >/dev/null; [ $? -ne 0 ] && [ -e $HOME/bin ] && export PATH=$HOME/bin:$PATH
#
##----------------------------------------------------------------------------------
## alias ###########################################################################
#
alias ll="/bin/ls -l --color"
alias la="/bin/ls -lah"
alias l="/bin/ls -A"
alias rm="/bin/rm -i"
alias cp="/bin/cp -i"
alias mv="/bin/mv -i"
alias f="/bin/clear"
#
##----------------------------------------------------------------------------------
## Constantes environnement ###############################################################
#
export LANG=fr_FR.UTF-8
export LANGUAGE=fr_FR
export ARCHFLAGS="-arch x86_64"
#
##----------------------------------------------------------------------------------
## oh-my-zsh ###########################################################################
#
export ZSH="$HOME/.oh-my-zsh/"
zstyle ':omz:update' mode auto # update automatically without asking
plugins=(git colored-man-pages zsh-navigation-tools zsh-autosuggestions)
export EDITOR=nano
#source /usr/share/powerline/bindings/zsh/powerline.zsh
export ZSH_THEME="agnoster"
export LANG=fr_FR.UTF-8
export LANGUAGE=fr_FR
source $ZSH/oh-my-zsh.sh
export PROMPT="%{%f%b%k%}
$(build_prompt)
> "
alias zshconfig="nano -cl ~/.zshrc"
##----------------------------------------------------------------------------------
## fontions utiles ###############################################################
#
function g() {
grep $@ | grep -v grep
}
function def_agent_ssh() {
memo_ssh="/run/user/$(id -u)/env_ssh"
[ -e $memo_ssh ] && {
eval $(cat $memo_ssh) >/dev/null
} || {
mkdir -p /run/user/$(id -u)
ssh-agent >$memo_ssh
eval $(cat $memo_ssh) >/dev/null
ssh-add
}
}
def_agent_ssh
##----------------------------------------------------------------------------------
EOF
clear
echo "Pour faire en sorte que **zsh** devienne votre "shell" par défaut passez la commande : chsh -s $(which zsh)
"
}