Created
April 18, 2013 19:55
-
-
Save anonymous/5415742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setopt multios autocd extendedglob glob bareglobqual nullglob rcexpandparam extendedglob autopushd auto_continue auto_cd | |
#autocd: you can skip the cd if your command is a valid folder path | |
#glob, extendedglob, bareglobquala nulllob extendedglob nice globbing | |
#multios Perform implicit tees or cats when multiple redirections are attempted (see the section `Redirection'). | |
#RC_EXPAND_PARAM (-P) | |
# Array expansions of the form `foo${xx}bar', where the parameter xx is set to (a b c), are substituted with | |
# `fooabar foobbar foocbar' instead of the default `fooa b cbar'. Note that an empty array will therefore | |
# cause all arguments to be removed. | |
#AUTO_PUSHD (-N) | |
# Make cd push the old directory onto the directory stack | |
#AUTO_CONTINUE | |
# With this option set, stopped jobs that are removed from the job table with the disown builtin command are | |
# automatically sent a CONT signal to make them running. | |
setopt append_history #append history from multiple running zsh | |
setopt hist_ignore_space #will not save commands with leading space in history | |
setopt hist_ignore_all_dups #do not store duplicate commands | |
unset complete_aliases | |
export LANG="en_US.UTF-8" | |
export EDITOR=vim | |
export PAGER=most | |
export BROWSER=firefox | |
export HIST_PATH=~/ | |
export TEMP_PATH=~/ | |
#setup vim stuff | |
bindkey -v | |
autoload -U edit-command-line | |
zle -N edit-command-line | |
bindkey -M vicmd v edit-command-line | |
# Lines configured by zsh-newuser-install | |
HISTFILE=~/.zsh_history | |
HISTSIZE=15000 | |
SAVEHIST=15000 | |
#setup zmv command | |
autoload -U zmv | |
#setup completions | |
autoload -Uz compinit && compinit | |
zmodload -i zsh/complist | |
#colors for different file types in ls | |
export LS_COLORS='no=0:fi=0:di=1;34:ln=1;36:or=1;40:mi=1;40:pi=31:so=33:bd=44;37:cd=44;37:ex=1;31:*.svg=32:*.JPE=32:*.jpg=32:*.jpeg=32:*.JPG=32:*.gif=32:*.png=32:*.jpeg=32:*.ppm=32:*.pgm=32:*.pbm=32:*.c=1;33:*.bat=1;33:*.py=1;33:*.sh=1;33:*.rb=1;33:*.C=1;33:*.h=1;33:*.cc=1;33:*.awk=1;33:*.pl=1;33:*.bz2=31:*.gz=31:*.tar=31:*.iso=31:*.rar=31:*.zip=31:*.lha=31:*.lzh=31:*.arj=31:*.tgz=31:*.taz=31:*.html=1;32:*.htm=1;32:*.pdf=1;32:*.doc=1;32:*.txt=1;32:*.log=1;32:*.out=1;32:*.conf=1;32:*.tex=1;32:*.nfo=1;32:*.srt=1;32:*.o=1;32:*.a=1;32:*.php3=31:*.m3u=35:*.mp3=35:*flac=35::*mkv=1;35:*mp4=1;35:*avi=1;35:*exe=38' | |
#if | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' | |
zstyle ':completion:*' completer _expand _complete # _correct _approximate | |
zstyle ':completion:*:approximate:' max-errors 'reply=( $((($#PREFIX+$#SUFFIX)/5 )) numeric )' | |
zstyle ':completion:*' completions 1 | |
zstyle ':completion:*' file-sort name | |
zstyle ':completion:*' glob 1 | |
zstyle ':completion:*' insert-unambiguous true | |
zstyle ':completion:*' list-colors '' | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
#cache for package managers | |
zstyle ':completion:*' use-cache on | |
zstyle ':completion:*' verbose on | |
zstyle ':completion:*' cache-path ~/.zshcache | |
#proper tabing for directorys ../ is niiice | |
zstyle ':completion:*' special-dirs true | |
#tabbing menu | |
zstyle ':completion:*' menu yes=long-list | |
zstyle ':completion:*' menu select=2 | |
#vim style control in completion lists | |
bindkey -M menuselect 'h' vi-backward-char # links | |
bindkey -M menuselect 'j' vi-down-line-or-history # unten | |
bindkey -M menuselect 'k' vi-up-line-or-history # oben | |
bindkey -M menuselect 'l' vi-forward-char # rechts | |
#search incrementaly in history | |
bindkey -M vicmd "/" history-incremental-search-backward | |
bindkey -M vicmd "?" history-incremental-search-forward | |
#removes the current line, lets you execute one other line, then inserts the removed line again. (works recursively) | |
bindkey -M vicmd "q" push-line | |
#press Ctrl+m to get a live manpget on the current cmd | |
bindkey -M vicmd 'H' run-help | |
#in tab completion press + to stay in the completion | |
bindkey -M menuselect "+" accept-and-menu-complete | |
#parameter completions for programms that understand --help | |
compdef _gnu_generic df wc tar make date mv cp grep sed feh awk tail head watch unzip unrar ln ssh diff cdrecord nc strings objdump od | |
#nice for kill (now with colors) | |
#zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' | |
zstyle ':completion:*:kill:*' command 'ps xf -u $USER -o pid,%cpu,tty,cputime,cmd' | |
zstyle ':completion:*:kill:*' insert-ids single | |
zstyle ':completion:*:*:kill:*' menu yes select | |
zstyle ':completion:*:kill:*' force-list always | |
zstyle ':completion:*:*:kill:*' list-colors '=(#b) #([0-9]#)*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] #([|\\_ ]#) #([^ ]#)*=0=01;31=0=01;34' | |
#nice for killall | |
zstyle ':completion:*:killall:*' command 'ps -u $USER -o cmd|grep --color=none -Eo "^[^ ]*"| grep --color=none -Eo "[^/]*$"|sed -e 1d' | |
#tabing for man pages | |
zstyle ':completion:*:man:*' separate-sections true | |
#allready rmed files will not show up again | |
zstyle ':completion:*:(cp|rm):*' ignore-line yes | |
zstyle ':completion:*:cp:*' special-dirs true | |
zstyle ':completion:*:*:firefox:*:*' file-patterns '*.(html|htm)' '%p:all-files' | |
#cd into folder only | |
zstyle ':completion:*:*:cd_wrapper:*:*' file-patterns '*(-/):directories' | |
zstyle ':completion:*:*:evince:*:*' file-patterns '*.pdf:pdfs:pdfs *(-/):directories' | |
#history search | |
autoload -U history-search-end | |
zle -N history-beginning-search-backward-end history-search-end | |
zle -N history-beginning-search-forward-end history-search-end | |
#fix insert mode fuckup | |
zle -A .backward-kill-word vi-backward-kill-word | |
zle -A .backward-delete-char vi-backward-delete-char | |
#proper undo | |
zle -A .undo vi-undo-change | |
# (needs to be fixed on per terminal base) | |
#key up/down will search for history lines beginning with the current line | |
bindkey "\e[A" history-beginning-search-backward-end | |
bindkey "\e[B" history-beginning-search-forward-end | |
#key home/end for first/last char in insert mode | |
bindkey "^[[7~" beginning-of-line | |
bindkey "^[[8~" end-of-line | |
#nice math stuff for scripts (sin exp etc.) | |
zmodload zsh/mathfunc | |
#TODO add VIMODE to prompt | |
function zle-keymap-select { | |
VIMODE="${${KEYMAP/vicmd/ M:command}/(main|viins)/}" | |
zle reset-prompt | |
} | |
zle -N zle-keymap-select | |
#cool prompt based on SSH/user | |
autoload promptinit && promptinit | |
case $TERM in | |
rxvt|rxvt-unicode|rxvt-256color|(dt|k|E)term) | |
preexec () { | |
lastcmd=`echo "$1" | tr '\n\r' ' '` | |
print -Pn "\e]83;title \"$lastcmd\"\a" | |
print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($lastcmd)\a" | |
} | |
;; | |
esac | |
setprompt () { | |
if [ `whoami` = "root" ]; then | |
prompt adam2 red green green | |
else | |
if [ -n "$SSH_CLIENT" ]; then | |
prompt adam2 yellow green green | |
else | |
[[ $OWNER == COCO ]] && prompt adam2 blue green green || prompt adam2 cyan green green | |
fi | |
fi | |
} | |
setprompt | |
#startup | |
rm -R ~/.macromedia/Flash_Player/ 2> /dev/null 1 > /dev/null # removes flash cookies | |
export PATH=/sbin:/usr/sbin:$PATH #so that root binaries are tab completed | |
#chnges the color of the cursor depending on wether the | |
if [[ $TERM = "rxvt-unicode" ]]; then #colorchanges not in login shell | |
zle-keymap-select () { | |
if [ $KEYMAP = vicmd ]; then | |
echo -ne "\033]12;Green1\007" | |
else | |
echo -ne "\033]12;Orange1\007" | |
fi | |
} | |
zle -N zle-keymap-select | |
zle-line-init () { | |
# zle -K viins | |
echo -ne "\033]12;Orange1\007" | |
} | |
zle -N zle-line-init | |
fi | |
bindkey -v | |
#terminal specific keys | |
bindkey -M viins '^?' backward-delete-char | |
bindkey -M viins '^h' backward-delete-char | |
#aliases | |
yt2mp3(){youtube-dl -t --extract-audio --audio-format mp3 "$*"} | |
capture(){ffmpeg -f x11grab -r 25 -s `xrandr |grep '*+'|grep -Eo "\w*x\w*"` -i :0.0 "$1"} | |
alias ba='pdflatex bachelor.tex; bibtex bachelor.tex; pdflatex bachelor.tex; pdflatex bachelor.tex; evince bachelor.pdf' | |
cd_wrapper () { cd $* ; echo $PWD ; ls --color ; } | |
alias cd=cd_wrapper | |
alias de="setxkbmap de" | |
alias neo="setxkbmap de neo" | |
alias us="setxkbmap us" | |
#ls | |
alias ls="ls -hF --color=auto" | |
alias la="ls -hF -a --color=auto" | |
alias l="cd ." | |
alias ll='ls -ahl --color; echo "\e[1;32m --[\e[1;34m Dirs:\e[1;36m `ls -al | egrep \"^drw\" | wc -l` \e[1;32m|\e[1;35m Files: \e[1;31m`ls -al | egrep -v \"^drw\" | grep -v total | wc -l` \e[1;32m]--"' | |
#random stuff | |
alias c='clear' | |
alias KILL='killall -KILL' | |
alias grep="grep -i --color=auto" | |
alias locate="locate -i" | |
alias inst="sudo aptitude install " | |
alias up="sudo aptitude update; sudo aptitude safe-upgrade" | |
alias px='ps aufx' | |
evince(){nohup evince $* > /dev/null &} | |
#moving, copying, removing | |
alias mv="mv -v --backup=existing" | |
alias rm="rm -v" | |
alias cp="cp -v" | |
alias mplayer="mplayer -idx -fs" | |
alias wget="wget --timeout 10" | |
#viming! | |
alias vim='vim -p' | |
alias v="vim" | |
alias cim="vim" | |
alias svim="sudo vim" | |
#network | |
alias vpn_rwth="sudo vpnc-connect /etc/vpnc.conf" | |
alias cupsconf="firefox http://localhost:631" | |
ncserve () { #use to server folder | |
echo "Server running!" | |
echo "Get data with:\nnc -v -q0 $(ifconfig | grep "inet addr:"| grep -v "127.0.0.1" | cut -d: -f2 | awk "{ print \$1}"|tr -d "Bcast ") 1337 | tar -kxv" | |
tar -cvf - $* | nc -v -q0 -l 1337 | |
} | |
alias clone="urxvt -ip -tint black -sh 10 -fade 50 -fg white -bg black -cr white -sl 10000 +sb &" #spawns a new urxvt in the same location / VARS | |
strlen(){echo -n "$1" | wc -c;} #returns the length of the first argument | |
alias printer="system-config-printer" #shows a gui for selecting printers | |
alias presentation_shell="urxvt -fn xft:terminus:pixelsize=30 -fade 0&" #a shell with bigger font | |
alias ppa="sudo add-apt-repository" #adds an ppa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment