Commits

Alain Leufroy committed 5e4b54a

[sh] add {z,}sh stuffs

Comments (0)

Files changed (3)

+#! /bin/bash
+
+#====================================
+#Commandes utiles pour tous les jours
+#====================================
+
+if [ -x /usr/bin/dircolors ]; then
+    eval "`dircolors -b`"
+    alias ls='ls --color=auto'
+    #alias dir='dir --color=auto'
+    #alias vdir='vdir --color=auto'
+
+    #alias grep='grep --color=auto'
+    #alias fgrep='fgrep --color=auto'
+    #alias egrep='egrep --color=auto'
+fi
+
+
+# editors
+# -------
+alias vi=vim
+e(){
+    # try to switch to a tmux emacs window
+    if test  "x" != "x$TMUX"; then
+        tmuxemacswindowname=$(tmux list-windows -F '#{window_name}'|grep emacs)
+        if test "x" != "$tmuxemacswindowname"; then
+            tmux select-window -t "$tmuxemacswindowname"
+        fi
+    fi
+    # try to interprete args (a.k.a. "path/to/file:5980: " as given by ``grep -n``)
+    line=$(echo $1 | sed 's/: *$//' | grep -E ':[0-9]+' | sed 's/^.*:\([0-9]\+\)/\1/')
+    if test "x" != "x$line"; then
+        filepath=$(echo $1 | sed 's/:.*$//' )
+        /usr/bin/emacsclient -n +$line $filepath
+    else
+        /usr/bin/emacsclient -n $@
+    fi
+}
+
+function vimless(){vim -R -c 'set filetype=python' -c 'map q :q!<CR>' -; }
+#eval `lesspipe`
+export LESS="-R"
+
+alias purge='find . "(" -name "*~" -o -name "*.pyc" -o -name "*.pyo" -o -name "*.o" -o -name "*.orig" -o -name "\#*\#" ")" -a -exec rm -f \{\} \;'
+
+alias psg='ps aux | grep'
+alias h='history|grep'
+alias targz='tar xzf'
+
+
+
+#file system aliases
+#-------------------
+alias ll='ls -l'
+alias lt='tree'
+alias la='ls -A'
+alias l='ls -CF'
+alias l.='ls -CF ..'
+alias du='du -h'
+
+alias ..='cd ..'
+alias ...='cd ../..'
+alias ....='cd ../../..'
+alias .....='cd ../../../..'
+alias -- -='cd -'
+
+function go {
+    cd $1
+    zsh
+}
+export go
+
+#Recherche de fichiers
+#---------------------
+alias g='grep -r --exclude ".svn"'
+alias pygrep='grep -r --exclude ".svn" --include "*.py"'
+alias rgrep='grep -r'
+alias grep='grep --color=auto'
+alias locu='updatedb --prunepaths="$PWD/.hg $PWD/.git" -l 0 -U ./ -o "$HOME/tmp/trashable/`pwd|sed 's:/:_:g'`.locdb"'
+alias loc='locate -i -d "$HOME/tmp/trashable/`pwd|sed 's:/:_:g'`.locdb"'
+locg (){
+    cmd="loc '$1'"
+    for arg in "$@"; do
+      cmd="$cmd|grep '$arg'"
+    done
+    eval "$cmd"
+}
+locgc (){
+    cmd="loc '$1'"
+    colorcmd=''
+    grepcmd=''
+    for arg in "$@"; do
+      grepcmd="$grepcmd|grep '$arg'"
+      colorcmd="$colorcmd|sed 's:$arg:\\\e[1;31m$arg\\\e[0m:g'"
+    done
+    eval "echo -e \"\$($cmd$grepcmd$colorcmd)\""
+}
+
+alias findh='find . -name'
+
+function f() {
+ if [ -n "$2" ]; then
+ TYPE="-type $2"
+ else
+ TYPE=""
+ fi
+ find -L . -name "*$1*" -prune \( \! -path "*.hg*" \)  2>/dev/null $TYPE;
+}
+
+export f
+
+function r() {
+ if [ -n "$2" ]; then
+ LOC="$2"
+ else
+ LOC="*"
+ fi
+ rgrep --color --exclude=.hg "$1" $LOC
+}
+
+export r
+#PYTHON
+#------
+alias pylintq='pylint --report=n --include-id=y -f colorized'
+alias p='python'
+alias ip='ipython'
+alias p24='python2.4'
+alias p25='python2.5'
+alias p26='python2.6'
+alias p30='python3.0'
+alias p31='python3.1'
+alias pypathupdate='export PYTHONPATH=`pwd`:$PYTHONPATH'
+
+#MERCURIAL
+#---------
+alias hgd='hg diff'
+alias hgv='hg qv'
+alias hgi='hg incoming'
+alias hgh='hg head'
+alias hgl='hg log -G --stat -p| less'
+
+# #virtualenv
+# #----------
+# rel2abs() {
+#   [ "$#" -eq 1 ] || return 1
+#   ls -Ld -- "$1" > /dev/null || return
+#   dir=$(dirname -- "$1" && echo .) || return
+#   dir=$(cd -P -- "${dir%??}" && pwd -P && echo .) || return
+#   dir=${dir%??}
+#   file=$(basename -- "$1" && echo .) || return
+#   file=${file%??}
+#   case $dir in
+#     /) printf '%s\n' "/$file";;
+#     /*) printf '%s\n' "$dir/$file";;
+#     *) return 1;;
+#   esac
+#   return 0
+# }
+
+# activate() {
+# if [[ "$1" == '' ]]; then
+#     local target=$(pwd)
+# else
+#     local target=$(rel2abs "$1")
+# fi
+# until  [[ "$target" == '/' ]]; do
+#     if test -e "$target/bin/activate"; then
+#         source "$target/bin/activate"
+# 	echo "$target sandbox activated"
+# 	return
+#     fi
+#     target=$(dirname "$target")
+# done
+# echo 'no sandbox found'
+# }
+
+#media
+#-----
+alias mplayer='/usr/bin/padsp /usr/bin/mplayer'
+
+############################################################
+# user path config
+############################################################
+if test "$XDG_CONFIG_HOME" = ""; then
+    export XDG_CONFIG_HOME="$HOME/.config"
+fi
+if test "$XDG_DATA_HOME" = ""; then
+    export XDG_DATA_HOME="$HOME/.local/share"
+fi
+if test "$XDG_BIN_HOME" = ""; then
+    export XDG_BIN_HOME="$HOME/.local/bin"
+fi
+if test "$XDG_LIB_HOME" = ""; then
+    export XDG_LIB_HOME="$HOME/.local/lib"
+fi
+if test "$XDG_DOWNLOAD_DIR" = ""; then
+    export XDG_DOWNLOAD_DIR="$HOME/tmp/download"
+fi
+
+#############################################################
+# deplacement/search
+#############################################################
+export GREP_OPTIONS='--exclude-dir=*.hg --exclude=\#*\# --exclude=*.orig --exclude=*.rej -I'
+export CDPATH=".:$HOME/src"
+
+for dir in ~/bin $XDG_BIN_HOME;do
+    if [ -d "$dir" ]; then
+        export PATH="$dir:$PATH"
+    fi
+done
+PATH=/home/alain/.local/experimental/usr/bin:$PATH
+export PATH
+
+
+
+######################################################
+# latex
+######################################################
+
+export TEXINPUTS=.:/home/alain/var/documentor/basedoc/formations/style:/home/alain/var/documentor/formation:$TEXINPUTS
+
+######################################################
+# ld
+######################################################
+
+LD_LIBRARY_PATH=/home/alain/lib:/home/alain/.local/lib:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=/home/alain/lib:/home/alain/.local/experimental/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=/home/alain/lib:/home/alain/.local/experimental/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH
+
+######################################################
+# python
+######################################################
+for dir in ~/lib/python $XDG_LIB_HOME/python2.7/site-packages/;do
+    if [ -d "$dir" ]; then
+        PYTHONPATH="$dir:$PYTHONPATH"
+    fi
+done
+export PYTHONPATH
+
+if [[ -e $XDG_CONFIG_HOME/python/startup.py ]]; then
+    export PYTHONSTARTUP=$XDG_CONFIG_HOME/python/startup.py
+fi
+
+######################################################
+# debian stuff
+######################################################
+# config pour création de .deb (pratique notamment avec emacs)
+export DEBFULLNAME="Alain Leufroy"
+export DEBEMAIL=alain.leufroy@logilab.fr
+export DEBCHANGE_RELEASE_HEURISTIC=changelog
+
+######################################################
+# Variables
+######################################################
+
+# editeur par defaut
+
+export LANG=fr_FR.utf8
+export LC_ALL=fr_FR.utf8
+export LC_LOCAL=fr_FR.utf8
+export EDITOR=emacs
+export BROWSER=iceweasel
+
+if [ ! -e "$ACTIVATE" ]; then
+    ACTIVATE="$PWD/bin/activate"
+fi
+
+if [ -e "$ACTIVATE" ]; then
+    source "$ACTIVATE"
+    echo "$ACTIVATE sourced"
+fi
+
+# Customize to your needs...
+for f in "$HOME/.config/sh/aliases"; do
+    [ -e "$f" ] && source "$f"
+done
+
+# security
+
+# # Start my GPG Agent if not yet running
+# if [ -z "$GPG_AGENT_INFO" ]; then
+#       # test if use-agent is really in your gpg.conf
+#       killall gpg-agent
+#       eval $(gpg-agent --daemon)
+# fi
+
+# # Start my SSH Agent if not yet running
+# if [ -z "$SSH_AUTH_SOCK" -a -z "$SSH_AGENT_PID" ]; then
+#       killall ssh-agent
+#       eval $(ssh-agent -t 86400)
+# fi
+# -*- mode: shell-script -*-
+# Path to your oh-my-zsh configuration.
+export ZSH=$HOME/.oh-my-zsh
+
+# Set to the name theme to load.
+# Look in ~/.oh-my-zsh/themes/
+export ZSH_THEME="proze"
+
+# Set to this to use case-sensitive completion
+# export CASE_SENSITIVE="true"
+
+# Comment this out to disable weekly auto-update checks
+# export DISABLE_AUTO_UPDATE="true"
+
+# Uncomment following line if you want to disable colors in ls
+# export DISABLE_LS_COLORS="true"
+
+# Uncomment following line if you want to disable autosetting terminal title.
+# export DISABLE_AUTO_TITLE="true"
+
+# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
+# Example format: plugins=(rails git textmate ruby lighthouse)
+plugins=(pip)
+
+source $ZSH/oh-my-zsh.sh
+
+source ~/.zshenv
+