2015-11-07 17:03:36 +00:00
|
|
|
|
# zshrc inspiré de celui de la formation debian de VIA
|
2015-06-03 21:39:41 +00:00
|
|
|
|
# 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
|
|
|
|
|
|
2015-10-08 09:30:48 +00:00
|
|
|
|
# adapté et amélioré par lhark
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
2018-07-19 18:55:05 +00:00
|
|
|
|
# Uncomment this line for perfomance analysis
|
|
|
|
|
#zmodload zsh/zprof
|
|
|
|
|
|
2018-11-23 18:40:17 +00:00
|
|
|
|
export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:~/bin:/opt/cuda/bin:~/.cargo/bin:~/go/bin
|
|
|
|
|
# Add ruby gems to path
|
|
|
|
|
if which ruby >/dev/null && which gem >/dev/null; then
|
|
|
|
|
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
|
|
|
|
|
fi
|
2016-10-27 07:51:43 +00:00
|
|
|
|
export EDITOR=/usr/bin/vim
|
|
|
|
|
# Prevent mime associations by wine
|
2018-02-26 08:17:54 +00:00
|
|
|
|
export WINEPREFIX="$HOME/.wine"
|
2016-10-27 07:51:43 +00:00
|
|
|
|
export WINEDLLOVERRIDES="winemenubuilder.exe=d"
|
2017-03-14 14:36:21 +00:00
|
|
|
|
export CUDA_ROOT=/opt/cuda
|
2017-09-11 17:10:39 +00:00
|
|
|
|
# Android SDK setup
|
2018-11-23 18:40:17 +00:00
|
|
|
|
export ANDROID_HOME="/opt/android-sdk"
|
2017-09-11 17:10:39 +00:00
|
|
|
|
export PATH="$PATH:$ANDROID_HOME/tools/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
|
|
|
|
# Configuration for virtualenv
|
|
|
|
|
export WORKON_HOME=$HOME/.virtualenvs
|
2018-07-19 18:55:05 +00:00
|
|
|
|
source /usr/bin/virtualenvwrapper_lazy.sh > /dev/null 2>&1
|
2018-02-26 08:18:40 +00:00
|
|
|
|
# disables prompt mangling in virtual_env/bin/activate
|
|
|
|
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
2015-11-07 17:05:17 +00:00
|
|
|
|
|
2016-04-28 20:45:30 +00:00
|
|
|
|
# Configuration for ROS
|
2016-05-14 16:28:56 +00:00
|
|
|
|
source /opt/ros/indigo/setup.zsh > /dev/null 2>&1
|
|
|
|
|
export PYTHONPATH=/opt/ros/indigo/lib/python2.7/site-packages:$PYTHONPATH
|
|
|
|
|
export PKG_CONFIG_PATH="/opt/ros/indigo/lib/pkgconfig:$PKG_CONFIG_PATH"
|
2016-04-28 20:45:30 +00:00
|
|
|
|
|
2018-01-11 11:18:18 +00:00
|
|
|
|
#run ssh-agent
|
|
|
|
|
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
|
|
|
|
|
ssh-agent > ~/.ssh-agent-thing
|
|
|
|
|
fi
|
|
|
|
|
if [[ "$SSH_AGENT_PID" == "" ]]; then
|
|
|
|
|
eval "$(<~/.ssh-agent-thing)"
|
|
|
|
|
fi
|
|
|
|
|
|
2018-02-26 08:18:40 +00:00
|
|
|
|
# Get rc dir path
|
|
|
|
|
RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
|
|
|
|
|
|
|
|
|
|
# Import utility functions
|
2018-07-10 19:35:05 +00:00
|
|
|
|
# Colors needed for the prompt definition
|
|
|
|
|
autoload -U colors
|
|
|
|
|
colors
|
2018-02-26 08:18:40 +00:00
|
|
|
|
. "$RC_PATH/functions"
|
|
|
|
|
. "$RC_PATH/aliases"
|
|
|
|
|
. "$RC_PATH/prompt"
|
2016-04-28 20:45:30 +00:00
|
|
|
|
|
2018-02-26 08:18:40 +00:00
|
|
|
|
# Check for rc updates in the background
|
|
|
|
|
(check_rc_update&) 2> /dev/null
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
2018-02-26 08:18:40 +00:00
|
|
|
|
# Check for system updates inthe background
|
|
|
|
|
(check_sys_update&) 2> /dev/null
|
2015-11-07 17:05:17 +00:00
|
|
|
|
|
2019-04-11 08:15:23 +00:00
|
|
|
|
# Configuration for kubectl & helm
|
|
|
|
|
#if [ $commands[kubectl] ]; then
|
|
|
|
|
source <(kubectl completion zsh)
|
|
|
|
|
#fi
|
|
|
|
|
|
|
|
|
|
export TILLER_NAMESPACE=gitlab-ci
|
|
|
|
|
#if [ $commands[helm] ]; then
|
|
|
|
|
source <(helm completion zsh)
|
|
|
|
|
#fi
|
2018-01-11 11:18:18 +00:00
|
|
|
|
|
2019-04-11 08:15:23 +00:00
|
|
|
|
### TODO WHERE ARE THE ALIASES
|
2018-01-11 11:18:18 +00:00
|
|
|
|
###########
|
|
|
|
|
# Aliases #
|
|
|
|
|
###########
|
|
|
|
|
|
|
|
|
|
alias acs='apt-cache search'
|
|
|
|
|
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
|
|
|
|
|
alias ll='ls -lha'
|
|
|
|
|
alias less='less --quiet'
|
|
|
|
|
alias df='df --human-readable'
|
|
|
|
|
alias du='du --human-readable'
|
|
|
|
|
# alias mutt='mutt -y'
|
|
|
|
|
alias upgrade='sudo apt-get update && sudo apt-get -dy dist-upgrade && sudo apt-get dist-upgrade'
|
|
|
|
|
# alias -g GP='|grep '
|
|
|
|
|
alias grep="grep --color"
|
|
|
|
|
#alias ssh='ssh -A'
|
|
|
|
|
# alias -s txt=cat
|
|
|
|
|
alias rm='rm -I'
|
2019-04-11 08:15:23 +00:00
|
|
|
|
alias ipa='ip -c route && echo && ip -c address'
|
|
|
|
|
alias ipr='ip -c address && echo && ip -c route'
|
2018-01-11 11:18:18 +00:00
|
|
|
|
alias which='which -a'
|
|
|
|
|
# Le fameux cd ...etc
|
|
|
|
|
alias -g ...='../..'
|
|
|
|
|
alias -g ....='../../..'
|
|
|
|
|
alias -g .....='../../../..'
|
|
|
|
|
alias -g ......='../../../../..'
|
|
|
|
|
alias -g .......='../../../../../..'
|
|
|
|
|
alias -g ........='../../../../../../..'
|
|
|
|
|
# Hackish tweaks
|
|
|
|
|
alias steam-wine="WINEDEBUG=-all wine $WINEPREFIX/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe -no-dwrite -no-cef-sandbox >/dev/null 2>&1 &"
|
|
|
|
|
alias pacaur='AURDEST=$HOME/aur pacaur'
|
|
|
|
|
alias redwm='cd ~/aur/dwm-git; updpkgsums; makepkg -fi --noconfirm; killall dwm'
|
|
|
|
|
alias minecraft='java -jar $HOME/.minecraft/launcher.jar'
|
|
|
|
|
alias shuffle='mpv --shuffle --volume=50 --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"'
|
|
|
|
|
# Fix pour archlinux
|
|
|
|
|
alias zbarcam='LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam'
|
|
|
|
|
alias gitprunelocal="git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d"
|
|
|
|
|
alias gitprunelocalforce="git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D"
|
2019-04-11 08:15:23 +00:00
|
|
|
|
alias cantine="curl -s https://timechef.elior.com/api/restaurant/22/menus | jq -r '.[0].famillePlats[0].plats[].libelle'"
|
2018-01-11 11:18:18 +00:00
|
|
|
|
|
2016-03-30 15:27:36 +00:00
|
|
|
|
# Term specific hacks
|
|
|
|
|
case $TERM in
|
2018-11-23 18:39:57 +00:00
|
|
|
|
*kitty)
|
|
|
|
|
preexec () {
|
|
|
|
|
print -n "\e]0;kitty - $1 - ${HOST} - ${PWD}\a"
|
|
|
|
|
}
|
|
|
|
|
alias ssh='ssh_kitty'
|
|
|
|
|
;;
|
2016-03-30 15:27:36 +00:00
|
|
|
|
xterm*)
|
|
|
|
|
preexec () {
|
2018-02-26 08:16:54 +00:00
|
|
|
|
print -n "\e]0;xterm - $1 - ${HOST} - ${PWD}\a"
|
2016-03-30 15:27:36 +00:00
|
|
|
|
}
|
|
|
|
|
;;
|
|
|
|
|
# Fix broken ssh with st
|
|
|
|
|
st*)
|
2016-04-28 20:45:30 +00:00
|
|
|
|
preexec () {
|
2018-02-26 08:16:54 +00:00
|
|
|
|
print -n "\e]0;st - $1 - ${HOST} - ${PWD}\a"
|
2016-04-28 20:45:30 +00:00
|
|
|
|
}
|
2018-01-11 11:18:18 +00:00
|
|
|
|
# alias ssh='TERM=xterm ssh -A'
|
|
|
|
|
alias ssh='TERM=xterm ssh'
|
2016-03-30 15:27:36 +00:00
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
2018-04-01 05:06:12 +00:00
|
|
|
|
# Prevent CTRL-S from locking the terminal
|
|
|
|
|
stty -ixon
|
|
|
|
|
|
2016-03-30 15:27:36 +00:00
|
|
|
|
|
2016-10-27 07:51:43 +00:00
|
|
|
|
###############
|
|
|
|
|
# ZSH options #
|
|
|
|
|
###############
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
2017-07-25 04:56:54 +00:00
|
|
|
|
unsetopt rm_star_silent # Demande confirmation pour 'rm *' -> ou 'rm path/*'
|
2018-02-26 08:18:40 +00:00
|
|
|
|
unsetopt promptsubst # ZLE is handling prompt recalculation
|
2016-10-27 07:51:43 +00:00
|
|
|
|
# (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
|
2018-02-26 08:18:40 +00:00
|
|
|
|
# >| doit être utilisé pour pouvoir écraser un fichier déjà existant ;
|
2016-10-27 07:51:43 +00:00
|
|
|
|
# # le fichier ne sera pas écrasé avec '>'
|
|
|
|
|
#unsetopt clobber
|
|
|
|
|
setopt chase_links # Traite les liens symboliques comme il faut
|
2017-10-19 06:44:43 +00:00
|
|
|
|
setopt hist_verify # !! n\'est pas exécuté directement
|
2016-10-27 07:51:43 +00:00
|
|
|
|
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
|
|
|
|
|
setopt autopushd # cd pushes old dir to dir stack
|
|
|
|
|
setopt pushdsilent # Silent pushd & popd
|
|
|
|
|
setopt pushdtohome # pushd = pushd $HOME
|
|
|
|
|
setopt pushdignoredups
|
|
|
|
|
setopt pushdminus # This reverts the +/- operators for pushd.
|
2018-02-26 08:18:40 +00:00
|
|
|
|
setopt nobeep # Beeps are a pain
|
2016-10-27 07:51:43 +00:00
|
|
|
|
|
|
|
|
|
EXPORTTIME=0 # (Disabled) Display command execution time
|
|
|
|
|
HISTSIZE=10000000
|
|
|
|
|
SAVEHIST=10000000
|
|
|
|
|
HISTFILE=~/.history
|
|
|
|
|
HISTTIMEFORMAT="%d/%m %H:%M:%S "
|
2015-11-07 17:05:17 +00:00
|
|
|
|
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
2018-11-23 18:39:57 +00:00
|
|
|
|
######################
|
|
|
|
|
# Load ZSH functions #
|
|
|
|
|
######################
|
|
|
|
|
|
|
|
|
|
zmodload zsh/complist
|
|
|
|
|
autoload -U compinit promptinit
|
|
|
|
|
compinit
|
|
|
|
|
colors
|
|
|
|
|
autoload -U zsh-mime-setup
|
|
|
|
|
|
|
|
|
|
|
2016-10-27 07:51:43 +00:00
|
|
|
|
######################
|
|
|
|
|
# Completion options #
|
|
|
|
|
######################
|
2015-11-07 17:05:17 +00:00
|
|
|
|
|
2018-02-26 08:18:40 +00:00
|
|
|
|
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
|
|
|
|
|
|
2015-06-03 21:39:41 +00:00
|
|
|
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}'
|
|
|
|
|
zstyle ':completion:*' max-errors 3 numeric
|
|
|
|
|
zstyle ':completion:*' use-compctl false
|
2015-11-07 17:07:29 +00:00
|
|
|
|
zstyle ':completion:*' auto-description 'specify: %d'
|
|
|
|
|
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
|
|
|
|
zstyle ':completion:*' format 'Completing %d'
|
|
|
|
|
zstyle ':completion:*' group-name ''
|
|
|
|
|
zstyle ':completion:*' menu select=2
|
|
|
|
|
eval "$(dircolors -b)"
|
|
|
|
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
2018-02-26 08:18:40 +00:00
|
|
|
|
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
2015-11-07 17:07:29 +00:00
|
|
|
|
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
|
2016-10-27 07:51:43 +00:00
|
|
|
|
# Des couleurs pour la complétion cf kill -9 <tab><tab>
|
|
|
|
|
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
|
2018-02-26 08:18:40 +00:00
|
|
|
|
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
|
2016-10-27 07:51:43 +00:00
|
|
|
|
# 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 ~/.zs
|
2018-11-23 18:39:57 +00:00
|
|
|
|
# Enable ssh completion for kitty ssh
|
|
|
|
|
compdef ssh_kitty=ssh
|
2016-10-27 07:51:43 +00:00
|
|
|
|
|
|
|
|
|
|
2018-02-26 08:18:40 +00:00
|
|
|
|
################
|
|
|
|
|
# Prompt setup #
|
|
|
|
|
################
|
2016-10-27 07:51:43 +00:00
|
|
|
|
|
2018-02-26 08:18:40 +00:00
|
|
|
|
autoload -Uz vcs_info
|
|
|
|
|
promptinit
|
|
|
|
|
# Set timeout to 0.1s for switching to normal mode (might interfere with other apps)
|
|
|
|
|
export KEYTIMEOUT=1
|
|
|
|
|
zle -N zle-line-init
|
|
|
|
|
zle -N zle-keymap-select
|
2016-10-27 07:51:43 +00:00
|
|
|
|
|
|
|
|
|
##################
|
|
|
|
|
# Keyboard setup #
|
|
|
|
|
##################
|
|
|
|
|
|
|
|
|
|
bindkey -v # Vim type keybinds for ZLE (line editing)
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
|
|
|
|
# Gestion des touches spéciales pour mon clavier
|
|
|
|
|
# Pour connaître le code d'une touche, exécuter «cat»
|
|
|
|
|
typeset -A key
|
|
|
|
|
# CTRL + flèches
|
|
|
|
|
bindkey ";5D" beginning-of-line
|
|
|
|
|
bindkey ";5C" end-of-line
|
|
|
|
|
bindkey ";5A" up-line-or-history
|
|
|
|
|
bindkey ";5B" down-line-or-history
|
|
|
|
|
bindkey "^[[1;5D" beginning-of-line
|
|
|
|
|
bindkey "^[[1;5C" end-of-line
|
2018-02-26 08:18:40 +00:00
|
|
|
|
# Vim style incremental search
|
|
|
|
|
bindkey -M vicmd "/" history-incremental-search-backward
|
|
|
|
|
bindkey -M vicmd "?" history-incremental-search-forward
|
|
|
|
|
# Push the current command to the stack. ZLE will pop it on the next prompt
|
|
|
|
|
bindkey -M vicmd "q" push-line
|
2015-06-03 21:39:41 +00:00
|
|
|
|
# Page Up/Down
|
|
|
|
|
bindkey "^[[5~" history-beginning-search-backward
|
|
|
|
|
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)
|
2017-03-14 14:36:21 +00:00
|
|
|
|
bindkey "^[[H" beginning-of-line
|
2015-06-03 21:39:41 +00:00
|
|
|
|
bindkey "^[[4~" end-of-line
|
2017-03-14 14:36:21 +00:00
|
|
|
|
## Origine / Fin
|
2015-06-03 21:39:41 +00:00
|
|
|
|
bindkey "^[OH" beginning-of-line
|
|
|
|
|
bindkey "^[OF" end-of-line
|
2015-10-22 09:58:49 +00:00
|
|
|
|
# Delete
|
|
|
|
|
bindkey "[3~" delete-char
|
2015-11-24 17:58:10 +00:00
|
|
|
|
# Shift-Tab
|
|
|
|
|
bindkey "^[[Z" reverse-menu-complete
|
2015-06-03 21:39:41 +00:00
|
|
|
|
|
2015-11-07 17:08:13 +00:00
|
|
|
|
|
|
|
|
|
# ZSH syntax highlighting : /!\ keep at the bottom !
|
2018-07-19 19:04:12 +00:00
|
|
|
|
source "${RC_PATH}/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"
|