diff --git a/aliases b/aliases index 769e659..5481ff6 100644 --- a/aliases +++ b/aliases @@ -23,7 +23,7 @@ alias ip='ip --color' alias ipa='ip route && echo && ip --brief address' alias ipr='ip --brief address && echo && ip route' alias which='which -a' -# Le fameux cd ...etc +# The infamous cd ...etc alias -g ...='../..' alias -g ....='../../..' alias -g .....='../../../..' @@ -40,7 +40,7 @@ alias shuffle='mpv --shuffle --display-tags= --no-audio-display' alias steam="LD_PRELOAD='/usr/\$LIB/libstdc++.so.6 /usr/\$LIB/libgcc_s.so.1 /usr/\$LIB/libxcb.so.1 /usr/\$LIB/libgpg-error.so' /usr/bin/steam" alias surftor='http_proxy=socks5://127.0.0.1:9050/ surf' alias ytmp3='youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$(xsel -ob)"' -# Fix pour archlinux +# Fix for archlinux alias zbarcam='LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam' # vim: ft=zsh diff --git a/functions b/functions index d0922b4..f3eed29 100755 --- a/functions +++ b/functions @@ -1,6 +1,6 @@ -################################################################################ -# Debugging # -################################################################################ +############# +# Debugging # +############# # Global counter that can be used to diagnose duplicated calls printf "0" > /dev/shm/debug_counter @@ -13,9 +13,9 @@ debug_counter_print(){ printf "%d" "$(cat /dev/shm/debug_counter)" } -################################################################################ -# Update checking # -################################################################################ +################### +# Update checking # +################### check_rc_update () { # Get rc dir path @@ -57,9 +57,9 @@ check_sys_update () { fi } -################################################################################ -# Commands # -################################################################################ +############ +# Commands # +############ # Do the update uprc () { diff --git a/zshrc b/zshrc index 9de3905..a0564e8 100644 --- a/zshrc +++ b/zshrc @@ -1,12 +1,11 @@ -# zshrc inspiré de celui de la formation debian de VIA -# modifié par David_5_1 -# http://formation-debian.via.ecp.fr/ -# Ajouts depuis le wiki de archlinux http://wiki.archlinux.fr/Zsh -# et depuis http://doc.ubuntu-fr.org/zsh -# et depuis http://zsh.sourceforge.net/Guide/zshguide.html -# utilisation de https://github.com/zsh-users/zsh-syntax-highlighting - -# adapté et amélioré par lhark +# zshrc originaly inspired by ECP VIA's debian course file, +# and David_5-1's numerous improvements +# +# Regularly improved and tweaked by lhark since 2015 +# +# Uses the following plugins: +# https://github.com/zsh-users/zsh-syntax-highlighting +# https://github.com/zsh-users/zsh-autosuggestions # Uncomment this line for perfomance analysis #zmodload zsh/zprof @@ -48,6 +47,9 @@ colors . "$RC_PATH/functions" . "$RC_PATH/aliases" . "$RC_PATH/prompt" +# Setup colors for GNU ls +# TODO: check for GNU ls +eval "$(dircolors -b)" # Check for rc updates in the background (check_rc_update&) 2> /dev/null @@ -85,16 +87,13 @@ stty -ixon # 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 -# (disabled) If there is an unambiguous prefix to insert on -# the command line, that is done without a completion list being displayed -#setopt list_ambiguous -# >| 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 clobber # Allow file overwrite with > instead of >| +setopt chase_links # cd resolves symbolic links +setopt hist_verify # check the result of !! before executing setopt hist_ignore_all_dups # Only keep last version of duplicate command setopt sharehistory # Import new cmds from hist file & append typed cmds 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. 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 extendedglob # 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 null_glob # Delete pattern when no match found, instead of erroring +setopt complete_in_word # If the cursor is inside a word, completion is done from both ends +setopt extended_glob # Treat '#', '~' and '^' chars as part of patterns for filenames, etc. +setopt glob_complete # When the current word has a glob pattern, do not insert all the words resulting from the expansion +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 +# Disable legacy completion zstyle ':completion:*' use-compctl false 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:*' group-name '' +# Start menu style completion if there are more than 2 matches zstyle ':completion:*' menu select=2 -eval "$(dircolors -b)" zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} 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:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' zstyle ':completion:*' menu select=long zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s -zstyle ':completion:*' use-compctl false zstyle ':completion:*' verbose true -# Des couleurs pour la complétion cf kill -9 +# Add colors to the completion menu, eg. kill -9 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"' # Separate man page sections. Neat. zstyle ':completion:*:manuals' separate-sections true -# 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 +# Create completions cache +# Useful for slow completions like with package managers zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zs # Enable ssh completion for kitty ssh @@ -182,10 +186,10 @@ zle -N zle-keymap-select bindkey -v # Vim type keybinds for ZLE (line editing) -# Gestion des touches spéciales pour mon clavier -# Pour connaître le code d'une touche, exécuter «cat» +# Handling of special keys +# CTRL+V then press the key to display the code typeset -A key -# CTRL + flèches +# CTRL + arrows keys bindkey ";5D" beginning-of-line bindkey ";5C" end-of-line bindkey ";5A" up-line-or-history @@ -203,12 +207,13 @@ bindkey "^[[6~" history-beginning-search-forward # CTRL + Page UP/Down bindkey "^[[5;5~" beginning-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 "^[[4~" end-of-line -## Origine / Fin +# Begin / End bindkey "^[OH" beginning-of-line bindkey "^[OF" end-of-line +bindkey "^[[F" end-of-line # Delete bindkey "[3~" delete-char # Shift-Tab