mirror of
https://github.com/hcartiaux/dotfiles.git
synced 2024-10-18 17:25:23 +02:00
174 lines
5.1 KiB
Bash
Executable file
174 lines
5.1 KiB
Bash
Executable file
################################################################################
|
|
# .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/>.
|
|
################################################################################
|
|
|
|
source /etc/profile
|
|
|
|
##################################################################
|
|
## Basic variables
|
|
#
|
|
: ${UNAME=$(uname)}
|
|
|
|
##################################################################
|
|
## Shell and prompt configuration
|
|
#
|
|
autoload -U promptinit compinit
|
|
promptinit
|
|
compinit
|
|
|
|
setopt autopushd pushdminus pushdsilent pushdtohome
|
|
setopt autocd
|
|
setopt interactivecomments
|
|
setopt nobanghist
|
|
setopt noclobber
|
|
setopt HIST_REDUCE_BLANKS
|
|
setopt HIST_IGNORE_SPACE
|
|
setopt SH_WORD_SPLIT
|
|
setopt nohup
|
|
setopt chase_links
|
|
unsetopt ignore_eof
|
|
unsetopt rm_star_silent
|
|
unsetopt list_ambiguous
|
|
|
|
# Auto-correct
|
|
setopt correctall
|
|
alias vim='nocorrect vim'
|
|
alias git='nocorrect git'
|
|
|
|
# This will set the default prompt
|
|
source ~/.zsh/prompt_hyacinthe_setup
|
|
|
|
# Syntax highlighting
|
|
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
|
|
# type a directory's name to cd to it.
|
|
compctl -/ cd
|
|
|
|
##################################################################
|
|
## Auto-completion
|
|
#
|
|
setopt complete_aliases
|
|
|
|
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
|
|
zstyle ':completion:*:warnings' format '%Bno match for: : %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
|
|
|
|
##################################################################
|
|
## HISTORY
|
|
#
|
|
HISTFILE=~/.zhistory
|
|
HISTSIZE=10000
|
|
SAVEHIST=10000
|
|
setopt appendhistory
|
|
setopt incappendhistory
|
|
|
|
##################################################################
|
|
## Environment variables
|
|
#
|
|
|
|
if [ -f ~/.bash_environment ]; then
|
|
. ~/.bash_environment
|
|
fi
|
|
|
|
##################################################################
|
|
## Aliases
|
|
#
|
|
|
|
if [ -f ~/.bash_aliases ]; then
|
|
. ~/.bash_aliases
|
|
fi
|
|
|
|
# zsh specific
|
|
alias -g L="| less" # Write L after a command to page through the output.
|
|
alias -g H="| head -n 20" # Write L after a command to get the 20 first lines
|
|
alias -g G='| grep --color -i' # Write G after the command to grep it
|
|
alias -g TL='| tail -20'
|
|
alias -g NUL="> /dev/null 2>&1" # Redirect stdout and stderr to /dev/null.
|
|
alias -g NE="2> /dev/null" # Redirect stderr to /dev/null
|
|
|
|
[ -x /usr/bin/xpdf ] && alias -s pdf="xpdf"
|
|
|
|
##################################################################
|
|
## OAR & G5K Integration
|
|
#
|
|
|
|
if [ -f ~/.bash_oar ]; then
|
|
. ~/.bash_oar
|
|
fi
|
|
|
|
##################################################################
|
|
## Colors
|
|
#
|
|
|
|
eval `dircolors --sh`
|
|
export GREP_COLOR=31
|
|
|