remi /.zshrc

# ----------------------------------------------------------------------------------------------------
#
# @file         .zshrc
# @description  Fichier de configutation pour zsh
# @author       Rémi Prévost remi-exomel-com
# @version      20081116
#
# ----------------------------------------------------------------------------------------------------

export PATH="$HOME/bin:/usr/local/bin:/usr/local/sbin/:/bin:/sbin:/usr/bin:/usr/sbin"
xhost local: > /dev/null 2>&1
cat ~/.motd
echo -n '  Nous sommes le '
date
echo ''

# next lets set some enviromental/shell pref stuff up
setopt INC_APPEND_HISTORY SHARE_HISTORY
setopt APPEND_HISTORY
unsetopt BG_NICE                # do NOT nice bg commands
setopt CORRECT                  # command CORRECTION
setopt EXTENDED_HISTORY         # puts timestamps in the history
setopt MENUCOMPLETE
unsetopt ALL_EXPORT
unsetopt REC_EXACT

# Set/unset  shell options
setopt   notify globdots correct pushdtohome nocdablevars autolist
setopt   correctall autocd longlistjobs
setopt   autoresume histignoredups pushdsilent
setopt   autopushd pushdminus extendedglob rcquotes mailwarning
unsetopt bgnice autoparamslash

# Autoload zsh modules when they are referenced
zmodload -a zsh/stat stat
zmodload -a zsh/zpty zpty
zmodload -a zsh/zprof zprof
zmodload -a zsh/mapfile mapfile

export TZ="America/Montreal"
export HISTFILE=$HOME/.zhistory
export HISTSIZE=1000
export SAVEHIST=1000
export PAGER='most'
export EDITOR='vim'
export DISPLAY


# Code de couleurs textuels
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
        colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
        eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
        eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
        (( count = $count + 1 ))
done

PR_NO_COLOR="%{$terminfo[sgr0]%}"
PS1="$PR_BLUE%n$PR_WHITE@$PR_GREEN%m%u$PR_NO_COLOR:$PR_LIGHT_YELLOW%2c$PR_NO_COLOR%(!.#.$) "
RPS1=""
LC_ALL='fr_CA.UTF-8'
LANG='fr_CA.UTF-8'

case $TERM in
        *xterm*)
                precmd () {print -Pn "\e]0;%n@%M: %~\a"}
    ;;
esac

# Set some grep options
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;36'

# --------------------------------------------------------------------
# aliases
# --------------------------------------------------------------------

# alias ls
alias ls='ls --color=auto --group-directories-first'
alias ll='ls -la'
alias la='ls -A'
alias l='ls -l'

# alias divers
alias services='sudo netstat -tulpn'
alias d='watch date'
alias rm='rm -i'
alias free='free -m'
alias tar='tar $1 $2 --verbose $3'

# Raccourcis clavier
bindkey "^r" history-incremental-search-backward
bindkey ' ' magic-space    # also do history expansion on space
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward
bindkey '^K' kill-whole-line
bindkey -s '^B' " &\n"in # ctrl-B runs it in the background
bindkey "\e[1~" beginning-of-line # Home (console)
bindkey "\e[H" beginning-of-line # Home (xterm)
bindkey "\e[4~" end-of-line # End (console)
bindkey "\e[F" end-of-line # End (xterm)
bindkey "\e[2~" overwrite-mode # Ins
bindkey "\e[3~" delete-char # Delete

# Setup new style completion system. To see examples of the old style (compctl
# based) programmable completion, check Misc/compctl-examples in the zsh
# distribution.
autoload -U compinit
compinit

zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion::complete:*' use-cache on

zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST
zstyle ':completion:*:warnings' format '%BDésolé, pas de résultats pour : %d%b'
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s

setopt extendedglob
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"