Z Shell

Z Shell (zsh) est un shell Unix. C'est une version étendue du Bourne Shell (sh) et contient des fonctionnalites appartenant à plusieurs autres shells (bash, ksh, tcsh).

zsh: The Z Shell Manual
zsh: The Z Shell Manual

Antibody

Antibody est un manager de plugins zsh.

Installation

curl -sfL git.io/antibody | sh -s - -b /usr/local/bin

Dans le .zshrc pour charger antibody et la liste de plugin se trouvant dans .zsh_plugins.txt :

source <(antibody init)
antibody bundle < ~/.zsh_plugins.txt
getantibody/antibody
The fastest shell plugin manager. Contribute to getantibody/antibody development by creating an account on GitHub.

https://getantibody.github.io/

Spaceship

Spaceship est un plugin zsh permettant de configurer le prompt

denysdovhan/spaceship-prompt
:rocket::star: A Zsh prompt for Astronauts. Contribute to denysdovhan/spaceship-prompt development by creating an account on GitHub.

Exa

Exa est une commande afin de remplacer ls .
Il a des fonctionnalités étendues par exemple :

➜ ls -T -L 2
.
└── scripts
   ├── kpluginindex.json
   ├── Parachute
   ├── toggleparachute
   └── virtual-desktops-only-on-primary

https://the.exa.website/

Example de configuration

.zshrc

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

#antibody
source <(antibody init)
antibody bundle < ~/.zsh_plugins.txt

alias ls="exa"
alias ll="exa -l -T -L 1"
alias llt="exa -l -T -snew -L 1"
alias lt="exa -l -T -L"
alias dls="/bin/ls --color=auto"
alias sudo="sudo"
alias hosts_add='echo -e "127.0.0.1\t${1}" | sudo tee -a /etc/hosts' 

# Enable autocompletions
autoload -Uz compinit
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)
if [ $(date +'%j') != $updated_at ]; then
  compinit -i
else
  compinit -C -i
fi
zmodload -i zsh/complist

# Save history so we get auto suggestions
HISTFILE=$HOME/.zsh_history
HISTSIZE=100000
SAVEHIST=$HISTSIZE

# Options
# cd by typing directory name if it's not a command
setopt auto_cd 
setopt auto_list # automatically list choices on ambiguous completion
setopt auto_menu # automatically use menu completion
setopt always_to_end # move cursor to end if word had one match
setopt hist_ignore_all_dups # remove older duplicate entries from history
setopt hist_reduce_blanks # remove superfluous blanks from history items
setopt inc_append_history # save history entries as soon as they are entered
setopt share_history # share history between different instances
#setopt correct_all # autocorrect commands
setopt interactive_comments # allow comments in interactive shells
setopt glob_dots

# Improve autocompletion style
zstyle ':completion:*' menu select # select completions with arrow keys
zstyle ':completion:*' group-name '' # group results by category
zstyle ':completion:::::' completer _expand _complete _ignored _approximate # enable approximate matches for completion

bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

# Spaceship
SPACESHIP_PROMPT_ORDER=(
  time          # Time stamps section
  user          # Username section
  dir           # Current directory section
  host          # Hostname section
  git           # Git section (git_branch + git_status)
  package       # Package version
  node          # Node.js section
  golang        # Go section
  php           # PHP section
  rust          # Rust section
  venv          # virtualenv section
  pyenv         # Pyenv section
  ember         # Ember.js section
#  kubecontext   # Kubectl context section
#  terraform     # Terraform workspace section
  exec_time     # Execution time
  line_sep      # Line break
  battery       # Battery level and status
  vi_mode       # Vi-mode indicator
  jobs          # Background jobs indicator
  exit_code     # Exit code section
  char          # Prompt character
)

SPACESHIP_TIME_SHOW=true

# Env
export GOPATH=$HOME/development/go
.zshrc

.zsh_plugins.txt

zsh-users/zsh-completions
zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
denysdovhan/spaceship-prompt
zsh-users/zsh-history-substring-search
.zsh_plugins.txt