# Env vars emulate sh -c 'source /etc/profile' if which vimpager >& /dev/null; then export PAGER="vimpager -u $HOME/.vim/vimrc" else export PAGER="less" fi export EDITOR="vim" export LESS="-I -M -R --shift 5" export LANG=en_US.UTF-8 # FIXME: missing functions: add-prefix, remove-prefix, update-prefixes. # Prefixes management is a pain right now. export PATH="$HOME/.local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH" export LD_LIBRARY_PATH="/usr/local/lib:$HOME/.local/lib" # Fuck tmux. if [[ "$TERM" == screen ]]; then export TERM=screen-256color fi # Used for powerline-like-things. Set to false if you don’t want that. : ${POWERLINE:=false} # Escape key timeout. Increase if you have to work through lag. export KEYTIMEOUT=1 # History settings HISTFILE=~/.histfile HISTSIZE=5000 SAVEHIST=5000 setopt append_history hist_ignore_all_dups hist_reduce_blanks # Auto-cd setopt autocd # Disable beeps unsetopt beep # Disable live job notifications unsetopt notify # Extended globbing setopt extendedglob # No = expansion unsetopt equals # Correction setopt correct # Remove RPS1 after setopt transient_rprompt # Color vars autoload -U colors colors LS_COLORS='' LS_COLORS="$LS_COLORS"'*.exe=32;41:*.jar=32:' # Executables LS_COLORS="$LS_COLORS"'*.nes=32:*.smc=32:*.?64=32:*.gcm=32:*.gb=32:*.gbc=32:*.gba=32:*.nds=32:' # Emulators LS_COLORS="$LS_COLORS"'*.tex=33:*.ly=33:*.xml=33:*.xsl=33:*.js=33:*.css=33:*.php=33:*.py=33:*Makefile=33:*.asm=33:*.c=33:*.h=33:*.cpp=33:*.vala=33:*.sh=33:*.zsh=33:*.vim=33:*.scm=33:*.patch=33:*.gv=33:' # Sources LS_COLORS="$LS_COLORS"'*.odt=1;33:*.ods=1;33:*.odp=1;33:*.pdf=1;33:*.xhtml=1;33:*.html=1;33:*.htm=1;33:*.doc=1;33;41:*.xls=1;33;41:*.ppt=1;33;41:' # Text LS_COLORS="$LS_COLORS"'*.tar=1;31:*.xz=1;31:*.bz2=1;31:*.gz=1;31:*.deb=1;31:*.rpm=1;31:*.xpi=1;31:*.tgz=1;31:*.arj=1;31:*.taz=1;31:*.lzh=1;31:*.lzma=1;31:*.zip=1;31;43:*.z=1;31:*.Z=1;31:*.dz=1;31:*.bz=1;31:*.tbz2=1;31:*.tz=1;31:*.rar=1;31;43:*.ace=1;31:*.zoo=1;31:*.cpio=1;31:*.7z=1;31:*.rz=1;31:*.torrent=1;31:' # Archives LS_COLORS="$LS_COLORS"'*.svg=35:*.svgz=35:*.png=35:*.xcf=35:*.jpg=35:*.jpeg=35:*.gif=35:*.bmp=35:*.pbm=35:*.pgm=35:*.ppm=35:*.tga=35:*.xbm=35:*.xpm=35:*.tif=35:*.tiff=35:*.pcx=35:' # Images LS_COLORS="$LS_COLORS"'*.ogv=1;35:*.mng=1;35:*.avi=1;35;41:*.mpg=1;35;41:*.mpeg=1;35;41:*.mkv=1;35;41:*.vob=1;35;41:*.ogm=1;35;41:*.mp4=1;35;41:*.mov=1;35;41:*.wmv=1;35;41:*.asf=1;35;41:*.rm=1;35;41:*.rmvb=1;35;41:*.flv=1;35;41:*.gl=1;35:*.yuv=1;35:' # Video LS_COLORS="$LS_COLORS"'*.flac=36:*.oga=36:*.ogg=36:*.mid=36:*.midi=36:*.wav=36:*.aac=36;41:*.au=36:*.mka=36:*.mp3=36;41:*.wma=36;41:*.mpc=36;41:*.ape=36;41:*.ra=36;41:' # Musics/Sound files LS_COLORS="$LS_COLORS"$(echo $LS_COLORS | tr '[a-z]' '[A-Z]') LS_COLORS="$LS_COLORS"'no=0:fi=0:di=1;34:ln=1;36:pi=40;33:so=1;35:do=1;35:bd=40;33;1:cd=40;33;1:or=40;31;1:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=1;32:' # Various export LS_COLORS # Watch for login/logout watch=all # Smart completion zstyle :compinstall filename "$HOME/.zshrc" autoload -Uz compinit compinit # vi keybindings bindkey -v bindkey -a 'gg' beginning-of-buffer-or-history bindkey -a 'g~' vi-oper-swap-case bindkey -a G end-of-buffer-or-history bindkey '^?' backward-delete-char bindkey '^H' backward-delete-char # Ctrl + (Left|Right) bindkey "^[[1;5C" forward-word bindkey "^[[1;5D" backward-word # Alt + . bindkey "^[." insert-last-word # URxvt keys bindkey '[2~' overwrite-mode bindkey '[3~' delete-char bindkey '[5~' history-search-backward bindkey '[6~' history-search-forward bindkey '[7~' beginning-of-line bindkey '[8~' end-of-line bindkey '^r' history-incremental-search-backward # Gnome Terminal bindkey 'OH' beginning-of-line bindkey 'OF' end-of-line # Screen bindkey '[1~' beginning-of-line bindkey '[4~' end-of-line # Xterm bindkey '' beginning-of-line bindkey '' end-of-line # killall zstyle ':completion:*:killall:*' command 'ps -u $USER -o cmd' zstyle ':completion:*:sudo killall:*' command 'ps -o cmd' # Man bindkey '^X^H' run-help # Edit cmdline autoload edit-command-line zle -N edit-command-line bindkey '^xe' edit-command-line # Complete help bindkey '^xc' _complete_help function backward-kill-arg { local WORDCHARS="${WORDCHARS:s#[[:space:]]#}" zle backward-kill-word } zle -N backward-kill-arg # Alt-backspace bindkey '^[^?' backward-kill-arg # () [] {} ... # This one did me more harm than good. #bindkey -s '((' '()\ei' #bindkey -s '( (' '( )\ehi' #bindkey -s '(((' '(\ea( ))\ehhi' #bindkey -s '{{' '{}\ei' #bindkey -s '{ {' '{ }\ehi' #bindkey -s '{{{' '{\ea{ }}\ehhi' #bindkey -s '[[' '[]\ei' #bindkey -s '[ [' '[ ]\ehi' #bindkey -s '[[[' '[\ea[ ]]\ehhi' #bindkey -s "''" "'\ea'\ei" #bindkey -s '""' '"\ea"\ei' # Colored completion zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} # ... -> ../.. rationalise-dot() { if [[ $LBUFFER = *.. ]]; then LBUFFER+=/.. else LBUFFER+=. fi } zle -N rationalise-dot bindkey . rationalise-dot # Quick arithmetics if alias -m "$" | grep -q ""; then unalias "$" fi $ () { typeset -a input input=(${@//×/*}) input=(${input//x/*}) input=(${input//·/*}) input=(${input//÷//}) echo $((${input[@]})) } alias "$"="noglob $" # Pattern-matching mv autoload zmv # zsh-pattern mv alias zmv="noglob zmv -W" for dir in /etc/zsh ~/.zsh; do if [[ -d $dir ]]; then for file in $dir/*.zsh; do source $file done fi done # vim: set ts=4 sw=4 cc=80 :