summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <f-p@gmx.at>2008-11-03 22:48:23 +0100
committerFlorian Pritz <f-p@gmx.at>2008-11-03 22:48:23 +0100
commit5a4ff181a9fb2e89443531dc85a6a1454aeaa331 (patch)
treeb79ca4e91e6aa34f22ed15d939828509a6a6c7b8
downloaddotfiles-5a4ff181a9fb2e89443531dc85a6a1454aeaa331.tar.gz
dotfiles-5a4ff181a9fb2e89443531dc85a6a1454aeaa331.tar.xz
updated zshrc (screen title)
-rw-r--r--.zshrc361
1 files changed, 361 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
new file mode 100644
index 0000000..ab15397
--- /dev/null
+++ b/.zshrc
@@ -0,0 +1,361 @@
+#----------------------------------------------------#
+# File: ~/.zshrc #
+# Version: 0.2.3 #
+# Author: Florian "Bluewind" Pritz <f-p@gmx.at>#
+#----------------------------------------------------#
+
+#--------------------
+# History
+#--------------------
+HISTFILE=~/.zsh/histfile
+HISTSIZE=10000
+SAVEHIST=10000
+
+#--------------------
+# Keybindings
+#--------------------
+bindkey -e
+bindkey '\e[1~' beginning-of-line
+bindkey '\e[4~' end-of-line
+bindkey '\e[3~' delete-char
+bindkey '\e[2~' overwrite-mode
+bindkey "^[[7~" beginning-of-line # Pos1
+bindkey "^[[8~" end-of-line # End
+
+#--------------------
+# Completion stuff
+#--------------------
+autoload -Uz compinit
+compinit
+
+zstyle :compinstall filename '$HOME/.zshrc'
+
+# cache results because yaourt is slow
+zstyle ':completion:*' use-cache on
+zstyle ':completion:*' cache-path $HOME/.zsh/cache
+
+zstyle ':completion:*' completer _complete _match _approximate _7slash
+zstyle ':completion:*:match:*' original only
+
+# allow more mistypes if longer command
+zstyle -e ':completion:*:approximate:*' \
+ max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
+
+# ignore completion for commands we don't have
+zstyle ':completion:*:functions' ignored-patterns '_*'
+
+# show menu when tabbing
+zstyle ':completion:*' menu yes select
+zstyle ':completion:*' file-sort time
+
+zstyle ':completion:*' squeeze-slashes true
+
+#if in foo/bar don't show bar when cd ../<TAB>
+zstyle ':completion:*:cd:*' ignore-parents parent pwd
+
+# ignore case
+zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
+
+zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
+zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
+
+#--------------------
+# Other ZSH options
+#--------------------
+autoload colors
+colors
+setopt autocd
+setopt correct_all
+setopt extendedglob
+setopt auto_pushd
+setopt pushd_ignore_dups
+setopt no_hup
+setopt print_exit_value
+setopt SHARE_HISTORY
+
+#-----------------------
+# Variables
+#-----------------------
+export CDPATH=.:$HOME
+export OOO_FORCE_DESKTOP=gnome
+export PATH=${PATH}:${HOME}/misc/scripts:${HOME}/bin
+export EDITOR=nano
+export PAGER=less
+export LESSCHARSET="UTF-8"
+export LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-'
+export LESS='-i -c -N -w -g -M -R -P%t?f%f \
+:stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'
+
+#--------------------
+# Colors
+#--------------------
+export red='\e[0;31m'
+export RED='\e[1;31m'
+export green='\e[0;32m'
+export GREEN='\e[1;32m'
+export blue='\e[0;34m'
+export BLUE='\e[1;34m'
+export cyan='\e[0;36m'
+export CYAN='\e[1;36m'
+export NC='\e[0m'
+fg_green=$'%{\e[0;32m%}'
+fg_blue=$'%{\e[0;34m%}'
+fg_cyan=$'%{\e[0;36m%}'
+fg_red=$'%{\e[0;31m%}'
+fg_brown=$'%{\e[0;33m%}'
+fg_purple=$'%{\e[0;35m%}'
+fg_light_gray=$'%{\e[0;37m%}'
+fg_dark_gray=$'%{\e[1;30m%}'
+fg_light_blue=$'%{\e[1;34m%}'
+fg_light_green=$'%{\e[1;32m%}'
+fg_light_cyan=$'%{\e[1;36m%}'
+fg_light_red=$'%{\e[1;31m%}'
+fg_light_purple=$'%{\e[1;35m%}'
+fg_no_colour=$'%{\e[0m%}'
+fg_white=$'%{\e[1;37m%}'
+fg_black=$'%{\e[0;30m%}'
+
+#--------------------
+# Terminal title
+#--------------------
+prompt_eof_setup() {
+ # preexec() is run after you press enter on your command but before the command is run.
+ preexec() {
+ # define screen/terminal title with the current command (http://aperiodic.net/phil/prompt/)
+ case $TERM in
+ rxvt-unicode*)
+ printf '\33]2;%s\007' $1
+ ;;
+ screen*)
+ local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]}
+ printf '\ek%s\e\\' $CMD;;
+ esac
+ }
+}
+
+prompt_eof_setup "$@"
+
+#--------------------
+# Prompt
+#--------------------
+PS1="[${fg_cyan}%*${fg_no_colour}] - ${fg_light_red}$USERNAME${fg_no_colour} ${fg_light_blue}%~${fg_no_colour} > "
+
+## Spelling prompt
+SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) '
+
+#--------------------
+# Aliases
+#--------------------
+alias rm='rm -Iv'
+alias cp='cp -iv'
+alias mv='mv -iv'
+
+alias dum='du -kh --max-depth=2'
+alias du='du -kh'
+alias df='df -kTh'
+
+alias ls='ls -l --color=auto -h -b'
+alias ll='ls -l --color=auto -h -b'
+alias la='ls -la --color=auto -h -b'
+
+alias newpkg=' cp $HOME/misc/aur/PKGBUILD.proto PKGBUILD'
+
+alias pacman='pacman-color'
+alias ncmpc='ncmpc -c'
+alias yup='yaourt -Syu --aur'
+alias yu='yaourt -Syu'
+alias x='extract'
+alias more='less'
+alias youtube='youtube-dl -b '
+
+alias p='sudo powerpill'
+alias pa='sudo powerpill -Syu'
+alias py='sudo powerpill -S'
+
+alias ysi='yaourt -Si'
+alias yqo='yaourt -Qo'
+alias y='yaourt'
+alias ys='yaourt -S'
+alias ad='arson -D'
+
+alias -g gg='| grep --color'
+alias -g eg='| egrep --color'
+alias -g tt='| tail -n 20'
+alias -g vv='|'
+
+#alias -g pp="2>&1 | curl -F 'sprunge=<-' http://sprunge.us"
+alias -g pp="2>&1 | wgetpaste -X "
+
+alias -s txt=leafpad
+alias -s jpg=gpicview
+alias -s png=gpicview
+
+# source stuff that depends on the machine
+source ~/.private_stuff.zsh
+
+#--------------------
+# Functions
+#--------------------
+yd (){
+ mkdir $1
+ cd $1
+ yaourt -G $1
+}
+
+# Helper function to reuse gpg-agents
+initgpg(){
+ envfile="${HOME}/.gpginfo"
+ if test -f ${envfile} && kill -0 $(cut -d: -f 2 ${envfile} | head -n 1) 2>/dev/null; then
+ eval $(cat ${envfile})
+ else
+ eval `/usr/bin/gpg-agent --daemon --enable-ssh-support --write-env-file ${envfile}`
+ fi
+ export GPG_AGENT_INFO
+ export SSH_AUTH_SOCK
+ export SSH_AGENT_PID
+}
+initgpg
+
+google(){
+ firefox "http://www.google.com/search?&num=100&q=$*" &
+ disown firefox
+}
+
+leaf(){
+ leafpad $* &
+ disown leaf
+}
+
+function _7slash {
+ if [[ $words[CURRENT] = 7(#b)(*)(#e) ]]
+ then
+ compadd -U -X 'Correct leading 7 to /' -f /$match[1]
+ fi
+}
+
+function swap()
+{
+ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then
+ echo -e "${blue}Usage:$NC swap <file> <file>";
+ echo -e "Swaps files";
+ return 1
+ fi
+ if [ -f $1 ] && [ -f $2 ]; then
+ local TMPFILE=tmp.$$
+ mv "$1" $TMPFILE
+ mv "$2" "$1"
+ mv $TMPFILE "$2"
+ else
+ echo -e "${RED}Error:$NC One or more files don't exist"
+ return 1
+ fi
+}
+
+function my_ip()
+{
+ MY_IP=$(/sbin/ifconfig eth0 | awk '/inet/ { print $2 } ' | \
+sed -e s/addr://)
+ MY_ISP=$(curl www.wieistmeineip.de | awk '(/[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]\.[0-9]?[0-9]?[0-9]/) {print}' | awk 'gsub(/[>||<]/," ")' | awk '{print $3}')
+}
+
+function ii()
+{
+ echo -e "\nUser ${RED}"${USER:-"N/A"}"$NC on "${RED}${HOST:-"N/A"}"$NC"
+ echo -e "\n${RED}Additionnal information:$NC " ; uname -a
+ echo -e "\n${RED}Users logged on:$NC " ; w -h
+ echo -e "\n${RED}Current date:$NC " ; date
+ echo -e "\n${RED}Machine stats:$NC " ; uptime
+ echo -e "\n${RED}Memory stats:$NC " ; free
+ my_ip 2>&- ;
+ echo -e "\n${RED}Local IP Address:$NC" ; echo ${MY_IP:-"N/A"}
+ echo -e "\n${RED}ISP Address:$NC" ; echo ${MY_ISP:-"N/A"}
+ echo
+}
+
+function short_ii()
+{
+ echo -e "\nUser ${RED}"${USER:-"N/A"}"$NC on "${RED}${HOST:-"N/A"}"$NC"
+ echo -e "\n${RED}Current date:$NC " ; date
+ echo -e "\n${RED}Machine stats:$NC " ; uptime
+ echo
+}
+
+function repeat()
+{
+ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$1" = "-h" ]; then
+ echo -e "${blue}Usage:$NC repeat <number> <command>";
+ echo -e "Repeats a command";
+ return 1
+ fi
+ local i max
+ max=$1; shift;
+ for ((i=1; i <= max ; i++)); do
+ eval "$@";
+ done
+}
+
+#extract () {
+# if [ "$1" = "" ] || [ "$1" = "-h" ]; then
+# echo -e "${blue}Usage:$NC x <file>";
+# echo -e "Extracts <file>";
+# return 1
+# fi
+# for file in "$@"
+# do
+# if [ -f ${file} ] ; then
+# case ${file} in
+# *.tar.bz2) tar xjf ${file} ;;
+# *.tar.gz) tar xzf ${file} ;;
+# *.tbz2) tar xjf ${file} ;;
+# *.tgz) tar xzf ${file} ;;
+# *)
+# case $(file -bi ${file}) in
+# application/x-bzip2) bunzip2 ${file} ;;
+# application/rar) unrar x ${file} ;;
+# application/x-gzip) gunzip ${file} ;;
+# application/x-tar) tar xf ${file} ;;
+# application/zip) unzip ${file} ;;
+# application/x-compressed) uncompress ${file} ;;
+# application/x-7z-compressed) 7z x ${file} ;;
+# *) echo -e "${RED}Error:$NC No rule how to extract \"${file}\" ($(file -bi ${file}))" ;;
+# esac
+# ;;
+# esac
+# else
+# echo -e "${RED}Error:$NC \"${file}\" doesn't exist"
+# fi
+# done
+#}
+
+youtube2mp3 () {
+ for file in "$@"
+ do
+ if [ -f ${file} ] ; then
+ title=$(echo ${file} | sed 's/\(.*\)\..*/\1/')
+ case $(file -bi ${file}) in
+ video/mp4)
+ faad "${file}" &&
+ lame "${title}.wav" "${title}.mp3" &&
+ rm "${title}.wav"
+ ;;
+ video/x-flv)
+ ffmpeg -i "${file}" -vn -acodec copy "${title}.mp3"
+ ;;
+ *)
+ echo -e "${RED}Error:$NC No rule how to convert \"${file}\""
+ ;;
+ esac
+ else
+ echo -e "${RED}Error:$NC \"${file}\" doesn't exist"
+ fi
+ done
+}
+
+#--------------------
+# Greetings
+#--------------------
+echo -e "${CYAN}Welcome to ZSH ${RED}${ZSH_VERSION%.*}$NC"
+short_ii
+if [ -x /usr/bin/fortune ]; then
+ /usr/bin/fortune -s
+fi