Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 236f4c034a
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 547 lines (454 sloc) 15.279 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
# -*- shell-script -*-
# zsh init file
# http://forums.gentoo.org/viewtopic.php?t=187771&highlight=zsh

# only do this if your system has a global profile :)
source /etc/profile

bindkey -e

# autoloads
autoload -U compinit
compinit

# Key bindings, useful.
bindkey '^A' beginning-of-line # Home
bindkey '^E' end-of-line # End
bindkey '^D' delete-char # Del
bindkey '[3~' delete-char # Del
bindkey '[2~' overwrite-mode # Insert
bindkey '[5~' history-search-backward # PgUp
bindkey '[6~' history-search-forward # PgDn
bindkey " " magic-space # do history expansion on space
bindkey "^[[A" up-line-or-search # up arrow for back-history-search
bindkey "^[[B" down-line-or-search # down arrow for fwd-history-search

# Console linux, dans un screen
# if [ "$TERM" = "linux" -o "$TERM" = "screen" ] # -o "$TERM" = "rxvt" ]
# then
# bindkey '[1~' beginning-of-line # Home
# bindkey '[4~' end-of-line # End
# fi

# # xterm
# if [ "$TERM" = "xterm" ] ; then
# bindkey '' beginning-of-line # Home
# bindkey '' end-of-line # End
# fi

# #aterm
# #if [ "$TERM" = "rxvt" ] ; then
# bindkey '^[[7~' beginning-of-line # Home
# bindkey '^[[8~' end-of-line # End
# #fi



# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}":/sbin:/usr/sbin:/home/cycojesus/bin
fi

# Environment variables

# Do things like this...
#. /usr/share/emacs/*.*.*/etc/emacs.bash

# -nw is a new option in v23, which Tell Emacs not to use its special interface to X.
# export EDITOR="emacsclient -nw"
# export VISUAL="emacsclient"
# export ALTERNATE_EDITOR="emacs -Q"
# # set default pager
# if [ "$TERM" = "dumb" ]
# then
# export PAGER=""
# else
# export PAGER=less
# fi

# #optionally
# man() {
# if [ -e /tmp/emacs1000/server ]
# then
# emacsclient -nw -e "(man \"$1\")"
# else
# man $*
# fi
# }
# alias em='emacsclient'
# alias emc='emacsclient -c &'
#export EDITOR='emacs'
export EDITOR='nano'

export CVS_RSH="ssh"

# Prompts
if [ "$UID" = "0" ] ; then
export PS1=$'%{\e[00;37;41m%}[%*]@%m:%3~%{\e[01;37;41m%}$([[ $? != 0 ]] && echo ☠ || echo ☻) %(!.#.$)%{\e[0m%} '
else
export PS1=$'%{\e[01;32m%}[%*]@%m:%3~%{\e[01;32m%}$([[ $? != 0 ]] && echo ☠ || echo ☻) %(!.#.$)%{\e[0m%} '
fi
# export PS1="$(print '%{\e[1;32m%}%n%{\e[0m%} %{\e[1;34m%}%~%{\e[0m%}') > "
# export PS1="%n %c $ "
# export PS1="[%n@%m %c]$ "
export PS2="> "
#PROMPT='%n@%m> '
#RPROMPT=' %~' # prompt for right side of screen
#RPROMPT=' %T' # prompt for right side of screen


# Aliases

alias mv='nocorrect mv' # no spelling correction on mv
alias cp='nocorrect cp' # no spelling correction on cp
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir

alias ls="ls --color=auto"
alias la="ls -lahN --color=auto"
alias l.='ls -d .[a-zA-Z]* --color=auto'
alias ll="ls -l --color=auto"
alias lsd="find . -maxdepth 1 -type d|column"
alias d="find . -maxdepth 1 -type d|column"

alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

alias egrep='egrep --color=tty -d skip'
alias egrpe='egrep --color=tty -d skip'
alias fgrep='fgrep --color=tty -d skip'
alias fgrpe='fgrep --color=tty -d skip'
alias grep='grep --color=tty -d skip'
alias grpe='grep --color=tty -d skip'

## invoke this every time when you change .zshrc to
## recompile it.
src ()
{
    autoload -U zrecompile
    [ -f ~/.zshrc ] && zrecompile -p ~/.zshrc
    [ -f ~/.zcompdump ] && zrecompile -p ~/.zcompdump
    [ -f ~/.zshrc.zwc.old ] && rm -f ~/.zshrc.zwc.old
    [ -f ~/.zcompdump.zwc.old ] && rm -f ~/.zcompdump.zwc.old
    source ~/.zshrc
}

# history settings
HISTFILE=~/.history_zsh
HISTSIZE=3000
SAVEHIST=3000

# Other misc settings
LISTMAX=0

# Expansion options
zstyle ':completion:*' completer _complete _prefix
zstyle ':completion::prefix-1:*' completer _complete
zstyle ':completion:incremental:*' completer _complete _correct
zstyle ':completion:predict:*' completer _complete

# Completion caching
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST

# Expand partial paths
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-slashes 'yes'

# Include non-hidden directories in globbed file completions
# for certain commands

zstyle ':completion::complete:*' '\'

# tag-order 'globbed-files directories' all-files
zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)'

# Don't complete backup files as executables
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'

# Separate matches into groups
zstyle ':completion:*:matches' group 'yes'

# Describe each match group.
zstyle ':completion:*:descriptions' format "%B---- %d%b"

# Messages/warnings format
zstyle ':completion:*:messages' format '%B%U---- %d%u%b'
zstyle ':completion:*:warnings' format '%B%U---- no match for: %d%u%b'

# Describe options in full
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'

# }}}
# {{{ Simulate my old dabbrev-expand 3.0.5 patch

zstyle ':completion:*:history-words' stop verbose
zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' list false

#zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

#fl
#zstyle ':completion:*:processes-names' command 'ps -e -o comm='
zstyle ':completion:*:processes-names' command 'ps -e -o cmd='
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'

#zstyle ':completion:*:*:kill:*:processes' command 'ps x -o user,pid,s,stime,args'
# zsh Options

setopt \
    NO_all_export \
    always_last_prompt \
    NO_always_to_end \
    append_history \
    NO_auto_cd \
    auto_list \
    auto_menu \
    NO_auto_name_dirs \
    auto_param_keys \
    auto_param_slash \
    auto_pushd \
    auto_remove_slash \
    NO_auto_resume \
    bad_pattern \
    bang_hist \
    NO_beep \
    brace_ccl \
    correct_all \
    NO_bsd_echo \
    cdable_vars \
    NO_chase_links \
    NO_clobber \
    complete_aliases \
    complete_in_word \
    correct \
    NO_correct_all \
    csh_junkie_history \
    NO_csh_junkie_loops \
    NO_csh_junkie_quotes \
    NO_csh_null_glob \
    equals \
    extended_glob \
    extended_history \
    function_argzero \
    glob \
    NO_glob_assign \
    glob_complete \
    NO_glob_dots \
    glob_subst \
    hash_cmds \
    hash_dirs \
    hash_list_all \
    hist_allow_clobber \
    hist_beep \
    hist_ignore_dups \
    hist_ignore_space \
    NO_hist_no_store \
    hist_verify \
    hup \
    NO_ignore_braces \
    NO_ignore_eof \
    interactive_comments \
    inc_append_history \
    NO_list_ambiguous \
    NO_list_beep \
    list_types \
    long_list_jobs \
    magic_equal_subst \
    NO_mail_warning \
    NO_mark_dirs \
    NO_menu_complete \
    multios \
    nomatch \
    notify \
    NO_null_glob \
    numeric_glob_sort \
    NO_overstrike \
    path_dirs \
    posix_builtins \
    print_exit_value \
    NO_prompt_cr \
    prompt_subst \
    pushd_ignore_dups \
    NO_pushd_minus \
    pushd_silent \
    pushd_to_home \
    rc_expand_param \
    NO_rc_quotes \
    NO_rm_star_silent \
    NO_sh_file_expansion \
    sh_option_letters \
    short_loops \
    NO_sh_word_split \
    NO_single_line_zle \
    NO_sun_keyboard_hack \
    unset \
    NO_verbose \
    zle

stty pass8

#~ Cycojesus ~#
export PAGER=most

export PERLIO=stdio;

#pour libdvdcss (voir README de libdvdcss)
#export DVDCSS_METHOD=disc
export DVDCSS_VERBOSE=0

# comme ça plus personne diras 'rxvt not defined' :-p
#export TERM=xterm

export QEMU_TMPDIR=/home/cycojesus/tmp
export BROWSER=firefox

export WINEPREFIX=/home/cycojesus/.wine

#export GTK_IM_MODULE=xim
#export XMODIFIERS="@im=unikey"

## MES aliases ##
alias xboard='xboard -fd /usr/bin -fcp "./gnuchess xboard"'
alias gcc="LC_ALL=C gcc" # gcc en anglais
alias g++="LC_ALL=C g++" # g++ en anglais
alias wolfsp='wolfsp +set sv_cheats 1'
alias most='most -w'
alias time=/usr/bin/time
alias shutdown='shutdown -a'
alias kq='konqueror'
#alias qemu='qemu -kernel-kqemu -net nic -net tap,script=/etc/qemu-ifup'
alias emacs-nox='emacs -nw -r'
alias cal='cal -m'
alias html2txt='lynx -dump'
#alias emacs='emacsclient -a emacs'
alias emacs='XMODIFIERS= GTK_IM_MODULE= QT_IM_MODULE= emacs'
alias xephyr='Xephyr -ac -screen 1024x768 -br -reset -terminate :1'
alias gtypist='LANG=C gtypist'
alias screen='screen -U'

# Pour les handicapés du clavier comme moi
alias sl='ls'
alias ms='ls'
alias s='ls'
alias l='ls'
alias eamcs=$EDITOR
alias rmacs=$EDITOR
alias emcs=$EDITOR
alias vf='cd'

# radios
alias france_cul='mplayer http://players.tv-radio.com/metafichiers/france_culture_mp3-128k.m3u'
# alias france_inter='mplayer -cache 200 http://ogg.tv-radio.fr:1441/encoderfinter.ogg'
# alias france_info='mplayer -cache 200 http://ogg.tv-radio.fr:1441/encoderfinfo.ogg'
# alias france_musique='mplayer -cache 200 http://ogg.tv-radio.fr:1441/encoderfmusiques.ogg'

# enlève cette µ%£%)àç de complétion sur les noms d'utilisateurs de
# mes fesses en carton-pâte !!!!!!!!!!
zstyle ':completion:*:cd:*' tag-order !named-directories

# Émascule le Control-S sauvage
stty -ixon

# Dis monsieur, tu gères l'UTF-8 ?
# Bien entendu mon petit.
setopt printeightbit

# Met du beau dans la barre de titre des terminaux virtuels
case $TERM in
    *xterm*|{u|dt|k|e}term|urxvt)
    precmd () {
        print -Pn "\033]0;%~\007"
    }
    preexec () {
        print -Pn "\033]0;%n@%m <%l>\007"
    }
    ;;
esac

[ -e ~/.dir_colors ] && eval "$(dircolors ~/.dir_colors)"

# useful alias
#http://osnews.com/comments/20025
#http://blogs.techrepublic.com.com/10things/?p=352&tag=rbxccnbtr1
alias sharecurrentfolder='python -m SimpleHTTPServer'

alias irb='irb --readline -r irb/completion'




# http://news.ycombinator.com/item?id=1166542
#alias cp='rsync -aP'

alias gqview='geeqie'
alias ks=ls

[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm

# http://www.vcn.bc.aa/~dugan/slackware-fonts/
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=lcd_hrgb'

# http://www.node.mu/2010/11/24/is-your-bash-prompt-cramping-your-style/
# Print working directory after a cd.
# cd() {
# if [[ $@ == '-' ]]; then
# builtin cd "$@" > /dev/null # We'll handle pwd.
# else
# builtin cd "$@"
# fi
# echo -e " \033[1;30m"`pwd`"\033[0m"
# }


# autoload -Uz vcs_info

# zstyle ':vcs_info:*' stagedstr '%F{28}●'
# zstyle ':vcs_info:*' unstagedstr '%F{11}●'
# zstyle ':vcs_info:*' check-for-changes true
# zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
# zstyle ':vcs_info:*' enable git svn
# precmd () {
# if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
# zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{blue}]'
# } else {
# zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{red}●%F{blue}]'
# }

# vcs_info
# }

# setopt prompt_subst
# PROMPT='%F{blue}%n@%m %c${vcs_info_msg_0_}%F{blue} %(?/%F{blue}/%F{red})%% %{$reset_color%}'

# http://jbw.cc/2010/07/20/using-zsh/
#suffix alias, e.g.: ./bla.pdf -> evince bla.pdf
alias -s pdf=evince
alias -s avi=mplayer
alias -s mkv=mplayer

export LEDGER_FILE=~/org/comptes.ledger

PATH=$PATH:~/bin/eclipse/:~/bin/android-sdk-linux/tools/:~/bin/android-sdk-linux/platform-tools/

jr () {
    echo "--------------------------------------------------------------------------------"
    echo "\n##"$(date +" %A %F %l:%M%P") >>| ~/journal.txt
    cat >>| ~/journal.txt
}

#We, here, got no fucking fear!
export MOZ_GLX_IGNORE_BLACKLIST=1

# from http://sprunge.us/HdcD
df () {
local reverse="\e[7m"
local red="\e[31m"
local yellow="\e[33m"
local green="\e[32m"
local normal="\e[0m"
local l
local left
local right
local fill
local c
local cols=${COLUMNS:-80}
local df
if [[ -x $(which column) ]]
then
df=(${(f)"$(command df -P $@ | column -t)"})
else
df=(${(f)"$(command df -P $@)"})
fi
for l in $df
do
l=$(printf "%-${cols}s" "$l")
if [[ "$l" =~ "([0-9][0-9]?[0-9]?)%" ]]
then
c=$green
fill=$(($cols * ${match} / 100))
if [[ $match -gt 89 ]]
then
c=$red
elif [[ $match -gt 74 ]]
then
c=$yellow
fi
if [[ $fill > 0 ]]
then
left=${l[1,$fill]}
right=${l[$(($fill + 1)),$#l]}
else
left=""
right=$l
fi
print "${reverse}${c}${left}${normal}${right}"
else
print "${reverse}$l${normal}"
fi
done
}

# http://news.ycombinator.com/item?id=2467684
# Usage: show <local-port> <subdomain>
function show() {
    DOMAIN=".gwenhael.net"
    REMOTE="$2$DOMAIN"
    ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost"
}

# export PERL_LOCAL_LIB_ROOT="/home/cycojesus/perl5";
# export PERL_MB_OPT="--install_base /home/cycojesus/perl5";
# export PERL_MM_OPT="INSTALL_BASE=/home/cycojesus/perl5";
# export PERL5LIB="/home/cycojesus/perl5/lib/perl5/x86_64-linux-thread-multi:/home/cycojesus/perl5/lib/perl5";
# export PATH="/home/cycojesus/perl5/bin:$PATH";


alias alogcat='adb logcat'


# Here be thievery
# git branch in prompt
# http://stackoverflow.com/questions/1128496/to-get-a-prompt-which-indicates-git-branch-in-zsh
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
    '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'

zstyle ':vcs_info:*' enable git cvs svn

# or use pre_cmd, see man zshcontrib
vcs_info_wrapper() {
  vcs_info
  if [ -n "$vcs_info_msg_0_" ]; then
echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
  fi
}
RPROMPT=$'$(vcs_info_wrapper)'


echo "GNU screen cheat sheet: [ http://www.scribd.com/doc/20711754/Screen-Cheatsheet#download ]"
echo " screen -S <XXX> #create new session named XXX"
echo " screen -r <XXX> #resume a detached session named XXX"
echo " screen -x <XXX> #attach to running session XXX"
echo " (in screen): C-a d #detach from this session"

screen -list

echo "tmux (and GNU screen) cheat sheet: [ http://www.dayid.org/os/notes/tm.html ]"
echo " tmux #create new session"
echo " tmux attach #re-attach to session"
echo " (in tmux): ^b d #detach from current session"

tmux list-sessions
Something went wrong with that request. Please try again.