Skip to content

Instantly share code, notes, and snippets.

@agazso
Created November 30, 2012 22:26
Show Gist options
  • Select an option

  • Save agazso/4179146 to your computer and use it in GitHub Desktop.

Select an option

Save agazso/4179146 to your computer and use it in GitHub Desktop.
.zshrc
# Thing to set in interactive sessions of zsh
autoload -Uz vcs_info
# Execute before prompt
precmd()
{
vcs_info || return
}
TRAPZERR()
{
echo "\e[33;1mExit $?\e[0m"
}
function setcolors()
{
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
(( count = 0 ))
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOR="%{$terminfo[sgr0]%}"
}
setcolors
zstyle ':vcs_info:*' stagedstr '*'
zstyle ':vcs_info:*' unstagedstr '-'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats ' [%b%c%u] '
zstyle ':vcs_info:*' enable git bzr svn
PROMPT='$PR_YELLOW%m:%~ %# $PR_NO_COLOR'
RPROMPT='$PR_LIGHT_WHITE${vcs_info_msg_0_}$PR_NO_COLOR'
LISTMAX=2000
REPORTTIME=60
HISTSIZE=100
HISTFILE=~/.zsh_history
SAVEHIST=100
if [[ "${TERM-}" != "linux" ]] {
stty erase ^H
}
if [[ "${TERM-}" == "ansi" ]] {
TERM=vt100
}
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
bindkey '\e[3~' delete-char
bindkey '\e[5~' history-beginning-search-backward
bindkey '\e[6~' history-beginning-search-forward
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
bindkey '\eOH' beginning-of-line
bindkey '\eOF' end-of-line
alias qwcl 'qwcl.real'
alias rsh 'ssh'
if ( ls --version >&/dev/null ) {
alias ls='ls --color=tty'
}
alias cp='cp -i'
alias mv='mv -i'
alias di='ls -lF'
alias dir='ls -lF'
alias dor='ls -lF'
alias dur='ls -lF'
alias dira='ls -laF'
alias dird='ls -ldF'
alias uud='uudecode'
alias exe='chmod 755'
alias pub='chmod 644'
alias norm='chmod a-rwx,+rwX'
alias cls='clear'
alias p='popd'
alias ks='cd ~/Projects/Scalien/Keyspace'
alias sd='cd ~/Projects/Scalien/ScalienDB'
alias hb='cd ~/Projects/helpbox'
alias vg='valgrind -v --leak-check=full --show-reachable=yes --dsymutil=yes --track-origins=yes'
alias comlink='ssh atka@comlink.hu'
alias scalien='ssh agazso@scalien.com'
alias iaws='ssh -i ~/Projects/Scalien/ScalienDB/test/iglue.awskey'
alias dbg='(echo r ; cat) | gdb --args '
function ftp {
mesg n
ncftp $*
mesg y
}
alias cd..='cd ..'
case `uname` in
(Linux)
# export CC='gcc -m486'
# export CXX='g++ -I/usr/include/g++ -m486'
export PS_PERSONALITY=POSIX
;;
(SunOS|Solaris)
# export CC='gcc -msupersparc'
# export CXX='g++ -msupersparc'
alias ping='ping -s'
;;
esac
alias df='df -k'
alias du='du -k'
alias dus='du -sk (.*|*)(-/) | sort -n'
alias tmp='cd /tmp/$USERNAME'
alias cue='sudo cdrdao write --device IODVDServices '
function fch {
grep $* `find -name "*.[ch]"`
}
alias d2u="perl -p -i -e 's/\015//'"
alias indent='indent -kr -i8'
function hexdump {
hexdump -e '"%07.7_ax: " 8/1 "%02X " " - " 8/1 "%02X " "\n"'
}
alias ftps="lynx http://ftpsearch.ntnu.no/ftpsearch"
function xsc {
xterm -name Screen -fn "-*-fixed-thin-*-*-*-15-*-*-*-c-*-iso8859-1" -geometry 90x40 -e screen $* &
}
function findnew {
if [[ "$*" == "" ]] {
echo usage: findnew days
} else {
for i (*) {
if ( find $i -type f -atime -$1 >/dev/null ) {
echo NEW: $i
} else {
echo OLD: $i
}
}
}
}
function rehash {
builtin rehash
if [[ ${+man_pages} == 1 ]] {
unset man_pages
}
}
if [[ ${HOST-} == goldfish ]] {
alias cd+='mount /dev/hdb /cdrom -t iso9660'
alias cd-='umount /cdrom'
}
if [[ ${+DISPLAY} == 1 ]] {
function chpwd {
if [[ $PWD == $HOME* ]] {
echo -n "\e];${HOST-}:~${PWD#$HOME}\a"
} else {
echo -n "\e];${HOST-}:$PWD\a"
}
}
chpwd
}
function sleep5- {
sleep 4m
for i (30 25 20 15 10 5) {
echo Tap jon vissza $i mp mulva
sleep 5
}
}
function sleep5 {
sleep 30
sleep5-
}
function tx {
case "$1" {
*.tar)
tar xvf $1
;;
*.tgz|*.tar.gz|*.tar.Z|*.tar.z)
tar xvfz $1
;;
*.tar.bz2)
bunzip2 -c $1 | tar xvf -
;;
}
}
compctl -a alias
compctl -a unalias
compctl -v set
compctl -v unset
compctl -v export
compctl -o setopt
compctl -o unsetopt
compctl -B builtin
compctl -g '(.*|*)(-/)' cd
compctl -g '/usr/pkg/lst/*(:t)' pkgl
compctl -x 'p[1]' -u -- + chown
function get_pages {
if [[ ${+man_pages} == 0 ]] {
if [[ "${manpath-}" == "" ]] {
man_search=(/usr/man /usr/local/man /usr/X11R6/man)
} else {
man_search=($manpath)
}
for i in $man_search
do
man_pages=(${man_pages-} $i/man*/*(N:t:r:r))
done
unset man_search
}
reply=(${man_pages-})
}
compctl -x 'C[0,*/*]' -f -- + -K get_pages man
function get_targets {
if [[ -f makefile ]] {
local makefile=makefile
} else {
local makefile=Makefile
}
reply=(`cat $makefile | grep -v ^# | grep '^[[:alnum:]][^:]*:' | sed 's/:.*//'`)
}
compctl -x 's[-f],c[-1,-f]' -f -- + -K get_targets make
doom=(holsten dreher amstel spaten kaiser guinness steffl gosser veltins licher tuborg dab jever becks kirner jager harp faxe)
ssh_targets=(agazso@192.168.137.5 agazso@scalien.com agazso@int.scalien.com atka@192.168.5. scalien@194.38.107.165)
svn_targets=(add blame cat checkout co cleanup ci commit copy delete diff export help import info list log merge mkdir move propdel propedit propget proplist propset resolved revert status switch update)
git_targets=(add bisect branch checkout clone commit diff fetch grep init log merge mv pull push rebase reset rm show status tag)
iaws_targets=(ubuntu@)
compctl -x 'p[1]' -k ssh_targets -- + ssh
compctl -x 'p[1]' -k ssh_targets -- + scp
compctl -x 'p[1]' -k targets -- + telnet
compctl -x 'p[1]' -k svn_targets -- + svn
compctl -x 'p[1]' -k git_targets -- + git
compctl -x 'p[1]' -k iaws_targets -- + iaws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment