2013-12-11 18:33:41 +01:00
|
|
|
################################################################################
|
|
|
|
# .zshrc -- my personal ZSH configuration
|
|
|
|
# see https://github.com/hcartiaux/dotfiles
|
|
|
|
#
|
|
|
|
# Copyright (c) 2013 Hyacinthe Cartiaux <Hyacinthe.Cartiaux@uni.lu>
|
|
|
|
# _
|
|
|
|
# _______| |__ _ __ ___
|
|
|
|
# |_ / __| '_ \| '__/ __|
|
|
|
|
# _ / /\__ \ | | | | | (__
|
|
|
|
# (_)___|___/_| |_|_| \___|
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
# This file is NOT part of ZSH
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify it under
|
|
|
|
# the terms of the GNU General Public License as published by the Free Software
|
|
|
|
# Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
# version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
# details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along with
|
|
|
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
################################################################################
|
|
|
|
|
2013-05-02 23:38:51 +02:00
|
|
|
source /etc/profile
|
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
##################################################################
|
|
|
|
## Default locale for command line tools
|
|
|
|
#
|
2013-09-16 11:40:06 +02:00
|
|
|
export LANG=en_US.UTF-8
|
|
|
|
export LC_ALL=en_US.UTF-8
|
2013-09-03 10:31:42 +02:00
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
|
|
|
|
##################################################################
|
|
|
|
## Shell and prompt configuration
|
|
|
|
#
|
2013-05-02 23:38:51 +02:00
|
|
|
autoload -U promptinit compinit
|
|
|
|
promptinit
|
|
|
|
compinit
|
|
|
|
|
|
|
|
setopt autopushd pushdminus pushdsilent pushdtohome
|
|
|
|
setopt autocd
|
|
|
|
setopt cdablevars
|
|
|
|
setopt interactivecomments
|
|
|
|
setopt nobanghist
|
|
|
|
setopt noclobber
|
|
|
|
setopt HIST_REDUCE_BLANKS
|
|
|
|
setopt HIST_IGNORE_SPACE
|
|
|
|
setopt SH_WORD_SPLIT
|
|
|
|
setopt nohup
|
|
|
|
setopt correctall
|
|
|
|
setopt chase_links
|
|
|
|
unsetopt ignore_eof
|
|
|
|
unsetopt rm_star_silent
|
|
|
|
unsetopt list_ambiguous
|
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
# This will set the default prompt
|
|
|
|
source ~/.zsh/prompt_hyacinthe_setup
|
2013-05-02 23:38:51 +02:00
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
# Syntax highlighting
|
|
|
|
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
2013-05-02 23:38:51 +02:00
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
# type a directory's name to cd to it.
|
|
|
|
compctl -/ cd
|
|
|
|
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
## Auto-completion
|
|
|
|
#
|
2013-05-02 23:38:51 +02:00
|
|
|
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
|
|
|
|
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
|
|
|
|
zstyle ':completion:*:rm:*' ignore-line yes
|
|
|
|
zstyle ':completion:*:mv:*' ignore-line yes
|
|
|
|
zstyle ':completion:*:cp:*' ignore-line yes
|
|
|
|
|
|
|
|
# allow approximate
|
|
|
|
zstyle ':completion:*' completer _complete _match _approximate
|
|
|
|
zstyle ':completion:*:match:*' original only
|
|
|
|
zstyle ':completion:*:approximate:*' max-errors 1 numeric
|
|
|
|
# tab completion for PID :D
|
|
|
|
zstyle ':completion:*:*:kill:*' menu yes select
|
|
|
|
zstyle ':completion:*:kill:*' force-list always
|
|
|
|
# cd not select parent dir.
|
|
|
|
zstyle ':completion:*:cd:*' ignore-parents parent pwd
|
|
|
|
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
## Key bindings
|
|
|
|
## http://mundy.yazzy.org/unix/zsh.php
|
|
|
|
## http://www.zsh.org/mla/users/2000/msg00727.html
|
|
|
|
#
|
|
|
|
typeset -g -A key
|
|
|
|
bindkey "\e[1~" beginning-of-line
|
|
|
|
bindkey "\e[4~" end-of-line
|
|
|
|
bindkey "\e[5~" beginning-of-history
|
|
|
|
bindkey "\e[6~" end-of-history
|
|
|
|
bindkey "\e[3~" delete-char
|
|
|
|
bindkey "\e[2~" quoted-insert
|
|
|
|
bindkey "\e\e[C" forward-word
|
|
|
|
bindkey "\e\e[D" backward-word
|
|
|
|
|
|
|
|
bindkey '5D' emacs-backward-word
|
|
|
|
bindkey '5C' emacs-forward-word
|
|
|
|
|
|
|
|
bindkey "^H" backward-delete-word
|
|
|
|
# for rxvt
|
|
|
|
bindkey "\e[8~" end-of-line
|
|
|
|
bindkey "\e[7~" beginning-of-line
|
|
|
|
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
|
|
|
|
bindkey "\eOH" beginning-of-line
|
|
|
|
bindkey "\eOF" end-of-line
|
|
|
|
# for freebsd console
|
|
|
|
bindkey "\e[H" beginning-of-line
|
|
|
|
bindkey "\e[F" end-of-line
|
|
|
|
# completion in the middle of a line
|
|
|
|
bindkey '^i' expand-or-complete-prefix
|
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
|
|
|
|
##################################################################
|
|
|
|
## HISTORY
|
|
|
|
#
|
|
|
|
HISTFILE=~/.zhistory
|
|
|
|
HISTSIZE=10000
|
|
|
|
SAVEHIST=10000
|
|
|
|
setopt appendhistory
|
|
|
|
setopt incappendhistory
|
|
|
|
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
## Environment variables
|
|
|
|
#
|
|
|
|
export TSOCKS_CONFFILE=~/.dotfiles/tsocks/tsocks.conf
|
|
|
|
export SVN_EDITOR=vim
|
|
|
|
export EDITOR="vim"
|
|
|
|
|
|
|
|
# git
|
|
|
|
unset SSH_ASKPASS
|
|
|
|
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
## Aliases
|
|
|
|
#
|
|
|
|
|
2013-05-02 23:38:51 +02:00
|
|
|
alias vi='/usr/bin/vim'
|
|
|
|
alias ls='/bin/ls --color=auto -F --group-directories-first -h'
|
|
|
|
alias ll='/bin/ls -l --color=auto'
|
|
|
|
alias la='ll -a'
|
|
|
|
alias lh='la -h'
|
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
eval `dircolors -b`
|
2013-05-02 23:38:51 +02:00
|
|
|
export GREP_COLOR=31
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
|
|
|
|
alias top='htop'
|
|
|
|
|
|
|
|
alias cp='cp -iv'
|
|
|
|
alias mv='mv -iv'
|
|
|
|
alias rm='rm -i'
|
|
|
|
[ -x /usr/bin/most ] && alias more='most' && alias less='most'
|
|
|
|
|
|
|
|
# read man in vim with colors
|
|
|
|
man() {
|
|
|
|
/usr/bin/man $* | \
|
|
|
|
col -b | \
|
|
|
|
vim -R -c 'set ft=man nomod nolist' -
|
|
|
|
}
|
|
|
|
|
|
|
|
alias -s pdf="/usr/bin/xpdf "
|
2013-08-21 14:52:23 +02:00
|
|
|
alias killflash="ps aux | grep flash | xargs | cut -d' ' -f2 | xargs kill"
|
|
|
|
alias ssha="ssh-add"
|
2013-05-02 23:38:51 +02:00
|
|
|
alias cdpuppet="cd ~/Uni.lu-repos/puppet-repo"
|
|
|
|
alias cdsys="~/Uni.lu-repos/sysadmins-repo"
|
2013-06-21 11:11:43 +02:00
|
|
|
alias pass='eval `~/Uni.lu-repos/passwords-repo/.passrc` && pass'
|
2013-05-02 23:38:51 +02:00
|
|
|
|
|
|
|
# g5k alias
|
|
|
|
alias puppetplay='bundle exec puppetplay'
|
|
|
|
alias g5kcap='bundle exec cap'
|
|
|
|
alias g5k="~/Grid5000"
|
|
|
|
alias g5kpuppet="~/Grid5000/git.grid5000.fr/puppet-repo"
|
2013-10-24 12:52:42 +02:00
|
|
|
g5kpass() {
|
|
|
|
curdir=`pwd`
|
|
|
|
cd /home/hcartiaux/Grid5000/gitolite.grid5000.fr/password5k
|
|
|
|
source .passrc && /usr/bin/pass $*
|
|
|
|
cd $curdir
|
|
|
|
}
|
2013-05-02 23:38:51 +02:00
|
|
|
|
2013-12-11 18:33:41 +01:00
|
|
|
##################################################################
|
|
|
|
## RVM
|
|
|
|
#
|
2013-05-02 23:38:51 +02:00
|
|
|
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
|
|
|
PATH=$PATH:/usr/lib/ruby/gems/1.9.1/bin/:$HOME/.rvm/bin # Add RVM to PATH for scripting
|
|
|
|
|