|
|
@ -1,12 +1,11 @@ |
|
|
# zshrc inspiré de celui de la formation debian de VIA |
|
|
# zshrc originaly inspired by ECP VIA's debian course file, |
|
|
# modifié par David_5_1 |
|
|
# and David_5-1's numerous improvements |
|
|
# http://formation-debian.via.ecp.fr/ |
|
|
# |
|
|
# Ajouts depuis le wiki de archlinux http://wiki.archlinux.fr/Zsh |
|
|
# Regularly improved and tweaked by lhark since 2015 |
|
|
# et depuis http://doc.ubuntu-fr.org/zsh |
|
|
# |
|
|
# et depuis http://zsh.sourceforge.net/Guide/zshguide.html |
|
|
# Uses the following plugins: |
|
|
# utilisation de https://github.com/zsh-users/zsh-syntax-highlighting |
|
|
# https://github.com/zsh-users/zsh-syntax-highlighting |
|
|
|
|
|
# https://github.com/zsh-users/zsh-autosuggestions |
|
|
# adapté et amélioré par lhark |
|
|
|
|
|
|
|
|
|
|
|
# Uncomment this line for perfomance analysis |
|
|
# Uncomment this line for perfomance analysis |
|
|
#zmodload zsh/zprof |
|
|
#zmodload zsh/zprof |
|
|
@ -48,6 +47,9 @@ colors |
|
|
. "$RC_PATH/functions" |
|
|
. "$RC_PATH/functions" |
|
|
. "$RC_PATH/aliases" |
|
|
. "$RC_PATH/aliases" |
|
|
. "$RC_PATH/prompt" |
|
|
. "$RC_PATH/prompt" |
|
|
|
|
|
# Setup colors for GNU ls |
|
|
|
|
|
# TODO: check for GNU ls |
|
|
|
|
|
eval "$(dircolors -b)" |
|
|
|
|
|
|
|
|
# Check for rc updates in the background |
|
|
# Check for rc updates in the background |
|
|
(check_rc_update&) 2> /dev/null |
|
|
(check_rc_update&) 2> /dev/null |
|
|
@ -85,16 +87,13 @@ stty -ixon |
|
|
# ZSH options # |
|
|
# ZSH options # |
|
|
############### |
|
|
############### |
|
|
|
|
|
|
|
|
unsetopt rm_star_silent # Demande confirmation pour 'rm *' -> ou 'rm path/*' |
|
|
# man zshoptions |
|
|
|
|
|
|
|
|
|
|
|
unsetopt rm_star_silent # Ask before running 'rm *' or 'rm path/*' |
|
|
unsetopt promptsubst # ZLE is handling prompt recalculation |
|
|
unsetopt promptsubst # ZLE is handling prompt recalculation |
|
|
# (disabled) If there is an unambiguous prefix to insert on |
|
|
setopt clobber # Allow file overwrite with > instead of >| |
|
|
# the command line, that is done without a completion list being displayed |
|
|
setopt chase_links # cd resolves symbolic links |
|
|
#setopt list_ambiguous |
|
|
setopt hist_verify # check the result of !! before executing |
|
|
# >| doit être utilisé pour pouvoir écraser un fichier déjà existant ; |
|
|
|
|
|
# # le fichier ne sera pas écrasé avec '>' |
|
|
|
|
|
#unsetopt clobber |
|
|
|
|
|
setopt chase_links # Traite les liens symboliques comme il faut |
|
|
|
|
|
setopt hist_verify # !! n\'est pas exécuté directement |
|
|
|
|
|
setopt hist_ignore_all_dups # Only keep last version of duplicate command |
|
|
setopt hist_ignore_all_dups # Only keep last version of duplicate command |
|
|
setopt sharehistory # Import new cmds from hist file & append typed cmds |
|
|
setopt sharehistory # Import new cmds from hist file & append typed cmds |
|
|
setopt hist_ignore_space # Ignore cmds with leading space |
|
|
setopt hist_ignore_space # Ignore cmds with leading space |
|
|
@ -129,36 +128,41 @@ autoload -U zsh-mime-setup |
|
|
|
|
|
|
|
|
unsetopt glob_dots # (disabled) Do not require a leading '.' in a filename to be matched explicitly. |
|
|
unsetopt glob_dots # (disabled) Do not require a leading '.' in a filename to be matched explicitly. |
|
|
setopt auto_remove_slash # Auto remove slash at the end of autocomp when appropriate |
|
|
setopt auto_remove_slash # Auto remove slash at the end of autocomp when appropriate |
|
|
setopt completeinword # If the cursor is inside a word, completion is done from both ends |
|
|
setopt complete_in_word # If the cursor is inside a word, completion is done from both ends |
|
|
setopt extendedglob # Treat '#', '~' and '^' chars as part of patterns for filenames, etc. |
|
|
setopt extended_glob # Treat '#', '~' and '^' chars as part of patterns for filenames, etc. |
|
|
setopt globcomplete # When the current word has a glob pattern, do not insert all the words resulting from the expansion |
|
|
setopt glob_complete # When the current word has a glob pattern, do not insert all the words resulting from the expansion |
|
|
setopt null_glob # Delete pattern when no match found, instead of erroring |
|
|
unsetopt null_glob # Error when no glob match found, instead of deleting |
|
|
|
|
|
|
|
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' |
|
|
# man zshmodules (zstyle) |
|
|
|
|
|
# man zshcompsys (styles) |
|
|
|
|
|
# man zshcompwid (COMPLETION MATCHING CONTROL) |
|
|
|
|
|
|
|
|
|
|
|
#zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' |
|
|
|
|
|
# Max errors allowed while attempting completion |
|
|
zstyle ':completion:*' max-errors 3 numeric |
|
|
zstyle ':completion:*' max-errors 3 numeric |
|
|
|
|
|
# Disable legacy completion |
|
|
zstyle ':completion:*' use-compctl false |
|
|
zstyle ':completion:*' use-compctl false |
|
|
zstyle ':completion:*' auto-description 'specify: %d' |
|
|
zstyle ':completion:*' auto-description 'specify: %d' |
|
|
zstyle ':completion:*' completer _expand _complete _correct _approximate |
|
|
#zstyle ':completion:*' completer _expand _complete _correct _approximate |
|
|
|
|
|
zstyle ':completion:*' completer _complete _correct _approximate |
|
|
zstyle ':completion:*' format 'Completing %d' |
|
|
zstyle ':completion:*' format 'Completing %d' |
|
|
zstyle ':completion:*' group-name '' |
|
|
zstyle ':completion:*' group-name '' |
|
|
|
|
|
# Start menu style completion if there are more than 2 matches |
|
|
zstyle ':completion:*' menu select=2 |
|
|
zstyle ':completion:*' menu select=2 |
|
|
eval "$(dircolors -b)" |
|
|
|
|
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} |
|
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} |
|
|
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31" |
|
|
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31" |
|
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s |
|
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s |
|
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' |
|
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' |
|
|
zstyle ':completion:*' menu select=long |
|
|
zstyle ':completion:*' menu select=long |
|
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s |
|
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s |
|
|
zstyle ':completion:*' use-compctl false |
|
|
|
|
|
zstyle ':completion:*' verbose true |
|
|
zstyle ':completion:*' verbose true |
|
|
# Des couleurs pour la complétion cf kill -9 <tab><tab> |
|
|
# Add colors to the completion menu, eg. kill -9 <tab><tab> |
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31" |
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31" |
|
|
zstyle ':completion:*:processes' command 'ps -au$USER -o pid,time,cmd|grep -v "ps -au$USER -o pid,time,cmd"' |
|
|
zstyle ':completion:*:processes' command 'ps -au$USER -o pid,time,cmd|grep -v "ps -au$USER -o pid,time,cmd"' |
|
|
# Separate man page sections. Neat. |
|
|
# Separate man page sections. Neat. |
|
|
zstyle ':completion:*:manuals' separate-sections true |
|
|
zstyle ':completion:*:manuals' separate-sections true |
|
|
# Crée un cache des complétion possibles |
|
|
# Create completions cache |
|
|
# très utile pour les complétion qui demandent beaucoup de temps |
|
|
# Useful for slow completions like with package managers |
|
|
# comme la recherche d'un paquet aptitude install moz<tab> |
|
|
|
|
|
zstyle ':completion:*' use-cache on |
|
|
zstyle ':completion:*' use-cache on |
|
|
zstyle ':completion:*' cache-path ~/.zs |
|
|
zstyle ':completion:*' cache-path ~/.zs |
|
|
# Enable ssh completion for kitty ssh |
|
|
# Enable ssh completion for kitty ssh |
|
|
@ -182,10 +186,10 @@ zle -N zle-keymap-select |
|
|
|
|
|
|
|
|
bindkey -v # Vim type keybinds for ZLE (line editing) |
|
|
bindkey -v # Vim type keybinds for ZLE (line editing) |
|
|
|
|
|
|
|
|
# Gestion des touches spéciales pour mon clavier |
|
|
# Handling of special keys |
|
|
# Pour connaître le code d'une touche, exécuter «cat» |
|
|
# CTRL+V then press the key to display the code |
|
|
typeset -A key |
|
|
typeset -A key |
|
|
# CTRL + flèches |
|
|
# CTRL + arrows keys |
|
|
bindkey ";5D" beginning-of-line |
|
|
bindkey ";5D" beginning-of-line |
|
|
bindkey ";5C" end-of-line |
|
|
bindkey ";5C" end-of-line |
|
|
bindkey ";5A" up-line-or-history |
|
|
bindkey ";5A" up-line-or-history |
|
|
@ -203,12 +207,13 @@ bindkey "^[[6~" history-beginning-search-forward |
|
|
# CTRL + Page UP/Down |
|
|
# CTRL + Page UP/Down |
|
|
bindkey "^[[5;5~" beginning-of-buffer-or-history |
|
|
bindkey "^[[5;5~" beginning-of-buffer-or-history |
|
|
bindkey "^[[6;5~" end-of-buffer-or-history |
|
|
bindkey "^[[6;5~" end-of-buffer-or-history |
|
|
# Origine / Fin (pavé numérique) |
|
|
# Begin / End (numpad) |
|
|
bindkey "^[[H" beginning-of-line |
|
|
bindkey "^[[H" beginning-of-line |
|
|
bindkey "^[[4~" end-of-line |
|
|
bindkey "^[[4~" end-of-line |
|
|
## Origine / Fin |
|
|
# Begin / End |
|
|
bindkey "^[OH" beginning-of-line |
|
|
bindkey "^[OH" beginning-of-line |
|
|
bindkey "^[OF" end-of-line |
|
|
bindkey "^[OF" end-of-line |
|
|
|
|
|
bindkey "^[[F" end-of-line |
|
|
# Delete |
|
|
# Delete |
|
|
bindkey "[3~" delete-char |
|
|
bindkey "[3~" delete-char |
|
|
# Shift-Tab |
|
|
# Shift-Tab |
|
|
|