shell:zsh

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
shell:zsh [2020/10/31 12:16] – [Configuration .zshrc] d2airshell:zsh [2025/01/01 19:54] (Version actuelle) – [Configuration de ZSH] d2air
Ligne 1: Ligne 1:
 ====== Z Shell ====== ====== Z Shell ======
 +Configuration de [[wpfr>ZSH]], changement en shell par défaut, et ajout du framework [[https://ohmyz.sh/|Oh-My-Zsh]].
 ===== Fonctionnalités ===== ===== Fonctionnalités =====
 Zsh apporte les fonctionnalités suivantes : Zsh apporte les fonctionnalités suivantes :
Ligne 28: Ligne 29:
 Le nouveau fichier ''~/.zschrc'' peut être édité pour personnaliser la configuration, mais il existe un dossier ''~/.oh-my-zsh/custom'' afin d'ajouter un (ou plusieurs) fichier de configurations ''fichier.zsh'' qui écrasera les paramètres par défaut et ne sera pas modifié par les mises à jour. Le nouveau fichier ''~/.zschrc'' peut être édité pour personnaliser la configuration, mais il existe un dossier ''~/.oh-my-zsh/custom'' afin d'ajouter un (ou plusieurs) fichier de configurations ''fichier.zsh'' qui écrasera les paramètres par défaut et ne sera pas modifié par les mises à jour.
 Cependant les plugins doivent absolument se déclarer dans le fichier ''.zshrc'' juste avant le paramètre source ''$ZSH/oh-my-zsh.sh''. Cependant les plugins doivent absolument se déclarer dans le fichier ''.zshrc'' juste avant le paramètre source ''$ZSH/oh-my-zsh.sh''.
 +L'activation des plugins se fait en les passant en paramètres de la fonction ''plugins''
 +<code> 
 +plugins=(git github...) 
 +</code> 
 +Pour obtenir la liste des plugins disponibles il faudra utiliser la commande ''omz''
 +<code sh> 
 +omz plugin list 
 +</code>
 <file sh .zshrc> <file sh .zshrc>
 +#!/usr/bin/env zsh
 #   _________  _   _ ____   ____  #   _________  _   _ ____   ____ 
 #  |__  / ___|| | | |  _ \ / ___| #  |__  / ___|| | | |  _ \ / ___|
Ligne 36: Ligne 45:
 #(_)____|____/|_| |_|_| \_\\____| #(_)____|____/|_| |_|_| \_\\____|
 # #
 +
 # Plugins # Plugins
 # #
-plugins=(git github common-aliases dirhistory sudo nmap web-search python pip urltools copyfile encode64 history colored-man-pages)+plugins=(git github common-aliases dirhistory sudo nmap web-search python pip urltools copyfile encode64 history colored-man-pages ubuntu)
 # #
 </file> </file>
Ligne 86: Ligne 96:
 echo "L'entropie est de $(cat /proc/sys/kernel/random/entropy_avail)/$(cat /proc/sys/kernel/random/poolsize)" echo "L'entropie est de $(cat /proc/sys/kernel/random/entropy_avail)/$(cat /proc/sys/kernel/random/poolsize)"
 </file> </file>
 +Enfin, pour connaître les fonctionnalités d'un plugin la commande ''omz'' peut s'utiliser ainsi :
 +<code sh>
 +omz plugin info git
 +</code>
 ==== Thèmes ==== ==== Thèmes ====
 Il possible de modifier un thème en le copiant ou d'en créer un dans le dossier ''~/.oh-my-zsh/custom/themes''. Il possible de modifier un thème en le copiant ou d'en créer un dans le dossier ''~/.oh-my-zsh/custom/themes''.
 +Pour obtenir la liste des thèmes disponibles avec la commande ''omz'' :
 +<code bash>
 +omz plugin themes
 +</code>
 +Le thème se délare dans le fichier ''.zshrc'' juste avant le paramètre source ''$ZSH/oh-my-zsh.sh''.
 +<file sh .zshrc>
 +#!/usr/bin/env zsh
 +#   _________  _   _ ____   ____ 
 +#  |__  / ___|| | | |  _ \ / ___|
 +#    / /\___ \| |_| | |_) | |    
 +# _ / /_ ___) |  _  |  _ <| |___ 
 +#(_)____|____/|_| |_|_| \_\\____|
 +#
 +# Set name of the theme to load --- if set to "random", it will
 +# load a random theme each time oh-my-zsh is loaded, in which case,
 +# to know which specific one was loaded, run: echo $RANDOM_THEME
 +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
 +ZSH_THEME="robbyrussell"
 +#
 +plugins=(git github common-aliases dirhistory sudo nmap web-search python pip urltools copyfile encode64 history colored-man-pages ubuntu)
 +#
 +source $ZSH/oh-my-zsh.sh
 +#
 +</file>
 +Et pour obtenir la liste des thèmes disponibles avec la commande ''omz'' :
 +<code sh>
 +omz theme list
 +</code>
 +
 +===== Configuration de ZSH =====
 +Un exemple de fichier de configuration :
 +<file sh .zshrc>
 +#!/usr/bin/env zsh
 +#   _________  _   _ ____   ____ 
 +#  |__  / ___|| | | |  _ \ / ___|
 +#    / /\___ \| |_| | |_) | |    
 +# _ / /_ ___) |  _  |  _ <| |___ 
 +#(_)____|____/|_| |_|_| \_\\____|
 +#
 +#
 +
 +# Complétion 
 +autoload -U compinit
 +compinit
 +zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
 +zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
 +zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
 +                             /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
 +# Crée un cache des complétion possibles
 +# très utile pour les complétion qui demandent beaucoup de temps
 +# comme la recherche d'un paquet aptitude install moz<tab>
 +zstyle ':completion:*' use-cache on
 +zstyle ':completion:*' cache-path ~/.zsh_cache
 +# des couleurs pour la complétion
 +# faites un kill -9 <tab><tab> pour voir :)
 +zmodload zsh/complist
 +setopt extendedglob
 +zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
 + 
 +# Correction des commandes
 +setopt correctall
 +
 +# If you come from bash you might have to change your $PATH.
 +# export PATH=$HOME/bin:/usr/local/bin:$PATH
 +
 +# Path to your oh-my-zsh installation.
 +export ZSH="/home/d2air/.oh-my-zsh"
 +
 +# Set name of the theme to load --- if set to "random", it will
 +# load a random theme each time oh-my-zsh is loaded, in which case,
 +# to know which specific one was loaded, run: echo $RANDOM_THEME
 +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
 +ZSH_THEME="robbyrussell"
 +
 +# Set list of themes to pick from when loading at random
 +# Setting this variable when ZSH_THEME=random will cause zsh to load
 +# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
 +# If set to an empty array, this variable will have no effect.
 +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
 +
 +# Uncomment the following line to use case-sensitive completion.
 +# CASE_SENSITIVE="true"
 +
 +# Uncomment the following line to use hyphen-insensitive completion.
 +# Case-sensitive completion must be off. _ and - will be interchangeable.
 +# HYPHEN_INSENSITIVE="true"
 +
 +# Uncomment the following line to disable bi-weekly auto-update checks.
 +# DISABLE_AUTO_UPDATE="true"
 +
 +# Uncomment the following line to change how often to auto-update (in days).
 +# export UPDATE_ZSH_DAYS=13
 +
 +# Uncomment the following line to disable colors in ls.
 +# DISABLE_LS_COLORS="true"
 +
 +# Uncomment the following line to disable auto-setting terminal title.
 +# DISABLE_AUTO_TITLE="true"
 +
 +# Uncomment the following line to enable command auto-correction.
 +# ENABLE_CORRECTION="true"
 +
 +# Uncomment the following line to display red dots whilst waiting for completion.
 +# COMPLETION_WAITING_DOTS="true"
 +
 +# Uncomment the following line if you want to disable marking untracked files
 +# under VCS as dirty. This makes repository status check for large repositories
 +# much, much faster.
 +# DISABLE_UNTRACKED_FILES_DIRTY="true"
 +
 +# Uncomment the following line if you want to change the command execution time
 +# stamp shown in the history command output.
 +# You can set one of the optional three formats:
 +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
 +# or set a custom format using the strftime function format specifications,
 +# see 'man strftime' for details.
 +# HIST_STAMPS="mm/dd/yyyy"
 +
 +# Would you like to use another custom folder than $ZSH/custom?
 +# ZSH_CUSTOM=/path/to/new-custom-folder
 +
 +# Which plugins would you like to load?
 +# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
 +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
 +# Example format: plugins=(rails git textmate ruby lighthouse)
 +# Add wisely, as too many plugins slow down shell startup.
 +#plugins=(
 +#  git nmap github web-search
 +#)
 +plugins=(git github common-aliases dirhistory sudo nmap web-search python pip urltools copyfile encode64 history colored-man-pages ubuntu)
 +
 +source $ZSH/oh-my-zsh.sh
 +
 +# User configuration
 +
 +# export MANPATH="/usr/local/man:$MANPATH"
 +
 +# You may need to manually set your language environment
 +# export LANG=en_US.UTF-8
 +
 +# Preferred editor for local and remote sessions
 + if [[ -n $SSH_CONNECTION ]]; then
 +   export EDITOR='vim'
 + else
 +   export EDITOR='vim'
 + fi
 +
 +# Compilation flags
 +# export ARCHFLAGS="-arch x86_64"
 +
 +# ssh
 +# export SSH_KEY_PATH="~/.ssh/rsa_id"
 +
 +# Set personal aliases, overriding those provided by oh-my-zsh libs,
 +# plugins, and themes. Aliases can be placed here, though oh-my-zsh
 +# users are encouraged to define aliases within the ZSH_CUSTOM folder.
 +# For a full list of active aliases, run `alias`.
 +#
 +# Example aliases
 +# alias zshconfig="mate ~/.zshrc"
 +# alias ohmyzsh="mate ~/.oh-my-zsh"
 +alias zshconf="vim ~/.zshrc"
 +alias ohmyzsh="vim ~/.oh-my-zsh/custom/fichier.zsh"
 +#
 +</file>
  
  • shell/zsh.1604160971.txt.gz
  • Dernière modification : 2020/10/31 12:16
  • de d2air