dotfiles, initial commit
authornsukami <nsukami@kintanu.(none)>
Sun, 27 Jul 2014 02:31:21 +0000 (02:31 +0000)
committernsukami <nsukami@kintanu.(none)>
Sun, 27 Jul 2014 02:31:21 +0000 (02:31 +0000)
.bash_aliases [new file with mode: 0644]
.bash_color [new file with mode: 0644]
.bash_compl [new file with mode: 0644]
.bash_export [new file with mode: 0644]
.bash_function [new file with mode: 0644]
.bash_is [new file with mode: 0644]
.bash_marks [new file with mode: 0644]
.bash_shopt [new file with mode: 0644]
.bash_tmux [new file with mode: 0644]
.bashrc [new file with mode: 0644]
.tmux.conf [new file with mode: 0644]

diff --git a/.bash_aliases b/.bash_aliases
new file mode 100644 (file)
index 0000000..9e5920f
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# my weird aliases
+
+alias my_architecture='dpkg --print-architecture'
+
+alias ip='sudo ip'
+alias dhclient='sudo dhclient'
+
+alias my_debian_version='sudo cat /etc/debian_version'
+alias my_ubuntu_version='sudo cat /etc/issue'
+alias my_kernel_info='uname -a'
+alias my_kernel_release='uname -r'
+
+alias emacs="emacs -nw"
+alias grep="grep --color=auto"
+alias fgrep="fgrep --color=auto"
+alias egrep="egrep --color=auto"
+
+alias my_processes='ps aux | grep'
+
+# some more ls aliases
+alias ls='ls --hide="*~" --color'
+alias dir='dir --color=auto'
+alias vdir='vdir --color=auto'
+alias ll='ls -lh'
+alias la='ls -lah'
+
+# some more mor aliases
+alias aptitude="sudo aptitude"
+alias mkdir="mkdir -p"
+alias service="sudo service"
+alias halt='sudo halt'
+alias wvdial='sudo wvdial'
+alias apt-get='sudo apt-get'
+
+alias ..="cd .."
+alias ....="cd ../.."
+alias ......="cd ../../.."
+
+alias up2="cd ../.."
+alias up3="cd ../../.."
+alias up4="cd ../../../.."
+
+#git
+alias gstatus='git status'
+alias gcheckout='git checkout'
+alias gcommit='git commit'
+alias grebase='git rebase'
+alias gbranch='git branch'
+alias gpull='git pull'
+alias gpush='git push'
+alias gadd='git add'
+alias gmergetool='git mergetool'
+alias gdiff='git diff --color'
+alias glog='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
+alias glog2='git log --date-order --all --graph --name-status --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
+
+alias du="du -kh"    # Makes a more readable output.
+alias df="df -kTh"
+
+alias npost='emacs ~/Documents/hdjns_20140224_elementaryOS.org'
+alias ifconfig='/sbin/ifconfig'
+alias sshx='ssh dev_server'
+alias my_gatewayaddress="netstat -nr"
+
+alias reload_bash="source ~/.bashrc"
diff --git a/.bash_color b/.bash_color
new file mode 100644 (file)
index 0000000..bfabfb8
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+# my weird color file
+
+# Normal Colors
+Black='\e[0;30m'        # Black
+Red='\e[0;31m'          # Red
+Green='\e[0;32m'        # Green
+Yellow='\e[0;33m'       # Yellow
+Blue='\e[0;34m'         # Blue
+Purple='\e[0;35m'       # Purple
+Cyan='\e[0;36m'         # Cyan
+White='\e[0;37m'        # White
+
+# Bold
+BBlack='\e[1;30m'       # Black
+BRed='\e[1;31m'         # Red
+BGreen='\e[1;32m'       # Green
+BYellow='\e[1;33m'      # Yellow
+BBlue='\e[1;34m'        # Blue
+BPurple='\e[1;35m'      # Purple
+BCyan='\e[1;36m'        # Cyan
+BWhite='\e[1;37m'       # White
+
+# Background
+On_Black='\e[40m'       # Black
+On_Red='\e[41m'         # Red
+On_Green='\e[42m'       # Green
+On_Yellow='\e[43m'      # Yellow
+On_Blue='\e[44m'        # Blue
+On_Purple='\e[45m'      # Purple
+On_Cyan='\e[46m'        # Cyan
+On_White='\e[47m'       # White
+
+NC="\e[m"               # Color Reset
+ALERT=${BWhite}${On_Red} # Bold White on red background
diff --git a/.bash_compl b/.bash_compl
new file mode 100644 (file)
index 0000000..76774b9
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# to complete jump
+_completemarks() {
+  local curw=${COMP_WORDS[COMP_CWORD]}
+  local wordlist=$(find $MARKPATH -type l -printf "%f\n")
+  COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
+  return 0
+}
+
+# complete jump & unmark commands with result of _completemarks
+complete -F _completemarks jump unmark
+
+
+# to complete ssh
+_complete_hosts () {
+    COMPREPLY=()
+    local cur=${COMP_WORDS[COMP_CWORD]}
+    local host_list=`{ 
+for c in /etc/ssh_config /etc/ssh/ssh_config ~/.ssh/config
+do [ -r $c ] && sed -n -e 's/^Host[[:space:]]//p' -e 's/^[[:space:]]*HostName[[:space:]]//p' $c
+done
+for k in /etc/ssh_known_hosts /etc/ssh/ssh_known_hosts ~/.ssh/known_hosts
+do [ -r $k ] && egrep -v '^[#\[]' $k|cut -f 1 -d ' '|sed -e 's/[,:].*//g'
+done
+sed -n -e 's/^[0-9][0-9\.]*//p' /etc/hosts; }|tr ' ' '\n'|grep -v '*'`
+    COMPREPLY=( $(compgen -W "${host_list}" -- $cur))
+    return 0
+}
+
+# complete ssh & host commands w/ result of _complete_hosts
+complete -F _complete_hosts ssh
+complete -F _complete_hosts host
diff --git a/.bash_export b/.bash_export
new file mode 100644 (file)
index 0000000..21424bd
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+# my weird export file
+
+# colors inside less pager
+export LESS_TERMCAP_mb=$'\E[01;31m'
+export LESS_TERMCAP_md=$'\E[01;31m'
+export LESS_TERMCAP_me=$'\E[0m'
+export LESS_TERMCAP_se=$'\E[0m'
+export LESS_TERMCAP_so=$'\E[01;44;33m'
+export LESS_TERMCAP_ue=$'\E[0m'
+export LESS_TERMCAP_us=$'\E[01;32m'
+
+# personal bin directory
+export PATH=$PATH:$HOME/bin
+
+# pip wont download the same file twice
+export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
+
+# use emacs as default editor
+export EDITOR="emacs"
+
+# Use less command as a pager
+#export PAGER=less
+
+# history?
+export HISTSIZE=10000 # history size 
+export HISTFILESIZE=${HISTSIZE}
+export HISTIGNORE="ls:cd:[bf]g:exit" # ignore lines w/ ls, cd, ...
+export HISTCONTROL="ignoreboth" # ignore doublons and commands beginning by space
+# HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
+
+# for git to show me if modified files and if untracked files
+export GIT_PS1_SHOWDIRTYSTATE=true
+export GIT_PS1_SHOWUNTRACKEDFILES=true
+export GIT_PS1_SHOWSTASHSTATE=true
+# You can further control behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated
+export GIT_PS1_SHOWUPSTREAM="auto, verbose, legacy, git" # auto, verbose, legacy, git
diff --git a/.bash_function b/.bash_function
new file mode 100644 (file)
index 0000000..2746e43
--- /dev/null
@@ -0,0 +1,273 @@
+#!/bin/sh
+# my weird function file
+
+my_pretty_print_json() {
+    python -m json.tool
+}
+
+my_not_start_service_on_boot(){
+    # service to not start on boot
+    local service=$1;
+    update-rc.d  $service disable;
+}
+
+my_install_new_font(){
+    sudo fc-cache -v -f
+}
+
+my_launch_eth0(){
+    # set eth0 iface up
+    sudo ip link set eth0 up;
+    # ask for an ip via dhcp
+    sudo dhclient eth0;
+}
+
+#function to show the current branch
+my_show_current_branch(){
+    git rev-parse --abbrev-ref HEAD
+}
+
+# show me pdf number of pages
+my_pdf_nbpages(){
+    local filename=$1;
+    
+    echo $(pdftk $filename dump_data \
+        | grep -i numberofpages \
+        | awk '{print $2}');
+}
+
+# split pdf from one file to nbpages files
+my_pdf_explosion() {
+    local filename=$1;
+    echo $(pdftk $filename burst);
+}
+
+my_pdfs_to_xml() {
+    for i in $(ls | grep .pdf$); do 
+        pdftohtml -xml $i; 
+    done;
+}
+
+# function to show one line of file
+my_xline_of_file(){
+    local line_number=$1;
+    local filename=$2;
+    local p='p';
+
+    echo $(sed -n $line_number$p $filename);
+}
+
+# function to extract in one command
+my_xtract() {
+    local filename=$1;
+
+    if is_file $filename ; then
+        case $filename in
+           *.tar.xz)    tar xvfJ $filename     ;;
+            *.tar.bz2)   tar xvjf $filename     ;;
+            *.tar.gz)    tar xvzf $filename     ;;
+            *.bz2)       bunzip2 $filename      ;;
+            *.rar)       unrar x $filename      ;;
+            *.gz)        gunzip $filename       ;;
+            *.tar)       tar xvf $filename      ;;
+            *.tbz2)      tar xvjf $filename     ;;
+            *.tgz)       tar xvzf $filename     ;;
+            *.zip)       unzip $filename        ;;
+            *.Z)         uncompress $filename   ;;
+            *.7z)        7z x $filename         ;;
+            *)           echo "'$filename' cannot be extracted via extract" ;;
+        esac
+    else
+        echo "'$filename' is not a valid file"
+    fi
+}
+
+# function to list the content of an archive
+my_list_archive_content() {
+    local filename=$1;
+
+    if is_file $filename ; then
+        case $filename in
+           *.tar.xz)    tar tvfJ $filename     ;;
+            *.tar.bz2)   tar tvjf $filename     ;;
+            *.tar.gz)    tar tzvf $filename     ;;
+            *.bz2)       bunzip2 $filename      ;;
+            *.gz)        gunzip -l $filename       ;;
+            *.tar)       tar tvf $filename      ;;
+            *.tbz2)      tar tvjf $filename     ;;
+            *.tgz)       tar tvzf $filename     ;;
+            *.zip)       unzip -l $filename        ;;
+            *.Z)         uncompress -l $filename   ;;
+            *.7z)        7z l $filename         ;;
+            *)           echo "content of '$filename' cannot be listed :(" ;;
+        esac
+    else
+        echo "'$filename' is not a valid file"
+    fi
+}
+
+# dump a mysql database
+my_dump_mysql_db() {
+    local database=$1;
+
+    echo "dumping database '$database' ..."
+    mysqldump -u patrick -ppatrick $database  > $databse_dump_$(date +%m%d%Y).sql
+
+}
+
+my_dump_mysql_table() {
+    local database=$1;
+    local table=$2;
+
+    echo "dumping table '$table' from database '$database' ..."
+    mysqldump -u patrick -ppatrick $database $table > $table_dump_$(date +%m%d%Y).sql
+}
+
+my_uploadfile() {
+    local filename=$1
+    local ftp_url=$2;
+    local user=$3;
+    local password=$4;
+
+    echo "upload of '$filename' to '$ftp_url' by '$user' ..."
+    curl -T $filename $ftp_url --user $user:$password
+}
+
+my_find_string() {
+    local string_to_find=$1;
+    local directory=$2;
+
+    echo "recursive looking for the string '$string' inside '$directory' directory"
+    grep -H -r $string $directory;
+}
+
+my_find_string2() {
+    local string_to_find=$1;
+    local directory=$2;
+
+    echo "recursive looking for the string '$string' inside '$directory' directory"
+    find $directory | xargs grep -i $string -sl;
+
+}
+
+# extract md5 hash from a string
+my_xmd5() {
+    local $string=$1;
+
+    echo "md5 hash of '$string' is: "
+    echo -n "$sring" | md5sum;
+}
+
+# Creates an archive (*.tar.gz) from given directory.
+my_maketar() { 
+    local $directory=$1;
+
+    tar cvzf "${directory%%/}.tar.gz"  "${directory%%/}/"; 
+}
+
+# Create a ZIP archive of a file or folder.
+my_makezip() { 
+    local $file=$1;
+
+    zip -r "${file%%/}.zip" "$file";
+}
+
+# Make your directories and files access rights sane.
+my_sanitize() { chmod -R u=rwX,g=rX,o= "$@" ;}
+
+# Get IP adress on ethernet.
+my_ip() {
+    local my_ip=$( /sbin/ifconfig eth0 \
+       | awk '/inet/ { print $2 } ' \
+       | sed -e s/addr://);
+    local my_gtw="gtw: "$(netstat -nr | awk '{print $2}' | sed -n 3p);
+    echo ${my_ip:-"Not connected"}
+    echo ${my_gtw:-"Not connected"}
+}
+
+# Get current host related info.
+my_host_info() {
+    echo -e "\nYou are logged on ${BRed}$HOST"
+    echo -e "\n${BRed}Local IP Address :$NC" ; my_ip
+    echo -e "\n${BRed}Current date :$NC " ; date; calendar | head -1
+    echo -e "\n${BRed}Additionnal information:$NC " ; uname -a
+    echo -e "\n${BRed}Users logged on:$NC " ; \ 
+    w -hs \
+       | cut -d " " -f1 \
+       | sort \
+       | uniq
+    echo -e "\n${BRed}Machine stats :$NC " ; uptime
+    echo -e "\n${BRed}Memory stats :$NC " ; free -h
+    echo -e "\n${BRed}Diskspace :$NC " ; mydf / $HOME
+    echo -e "\n${BRed}Open connections :$NC "; netstat -pan --inet;
+    echo
+}
+
+# Pretty-print of 'df' output. Inspired by 'dfc' utility.
+my_df() {
+    local fs=$1;
+
+    for fs ; do
+
+        if [ ! -d $fs ]
+        then
+          echo -e $fs" :No such file or directory" ; continue
+        fi
+
+        local info=( $(command df -P $fs | awk 'END{ print $2,$3,$5 }') )
+        local free=( $(command df -Pkh $fs | awk 'END{ print $4 }') )
+        local nbstars=$(( 20 * ${info[1]} / ${info[0]} ))
+        local out="["
+        for ((j=0;j<20;j++)); do
+            if [ ${j} -lt ${nbstars} ]; then
+               out=$out"*"
+            else
+               out=$out"-"
+            fi
+        done
+        out=${info[2]}" "$out"] ("$free" free on "$fs")"
+        echo -e $out
+    done
+}
+
+my_add_todo(){
+    local rememberfile="$HOME/.remember"
+    # if the file not exists, touch it
+    [[ ! -f $rememberfile ]] && touch $rememberfile
+    if [ $# -eq 0 ] ; then
+       echo "Type what you want to remember then, hit ^D: "
+       cat - >> $rememberfile;
+    else
+       #echo $(date +%m%d%Y)" -- $@" >> $rememberfile
+       echo $(date +%F)" -- $@" >> $rememberfile
+    fi    
+}
+
+my_reminder(){
+    local rememberfile="$HOME/.remember"
+
+    #is_not_file $remberfile && echo 'nothing to do' || 
+    #is_empty $rememberfile && echo 'nothing to do' || 
+    #display_todo "$@"
+    is_not_file $rememberfile || [[ $(cat $rememberfile | wc -l) = 0 ]] && echo "nothing to do" || my_display_todo "$@";
+}
+
+my_display_todo(){
+
+    local rememberfile="$HOME/.remember"
+    echo $#;
+    #[[ $# -eq 0 ]] && more $rememberfile || grep -i "$@" $rememberfile | more;
+    [[ $# -eq 0 ]] && is_file $rememberfile && is_not_empty_file $rememberfile && cat $rememberfile || grep -i "$@" $rememberfile;
+}
+
+
+my_lsbytesum() {
+    #lsbytesum - sum the number of bytes in a directory listing
+    TotalBytes=0
+    for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }')
+    do
+       let TotalBytes=$TotalBytes+$Bytes
+    done
+    TotalMeg=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc)
+    echo -n "$TotalMeg"
+}
diff --git a/.bash_is b/.bash_is
new file mode 100644 (file)
index 0000000..4be2682
--- /dev/null
+++ b/.bash_is
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# my weird function file to check if
+
+
+is_empty_string() {
+    local var=$1
+
+    [[ -z $var ]]
+}
+
+is_not_empty_string() {
+    local var=$1
+
+    [[ -n $var ]]
+}
+
+is_file() {
+    local file=$1
+
+    [[ -f $file ]]
+}
+
+is_not_file() {
+    ! is_file $1;
+}
+
+is_not_empty_file() {
+    local file=$1
+
+    [[ -s $file ]]    
+}
+
+is_empty_file() {
+    ! is_not_empty_file $1;
+}
+
+is_dir() {
+    local dir=$1
+
+    [[ -d $dir ]]
+}
+
+is_not_dir() {
+    ! is_dir $1;
+}
+
+is_not_empty_dir() {
+    local dir=$1
+
+    [[ -s $dir ]]    
+}
+
+is_empty_dir() {
+    ! is_not_empty_dir $1;
+}
diff --git a/.bash_marks b/.bash_marks
new file mode 100644 (file)
index 0000000..45a98e1
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# where all marks will be stored
+export MARKPATH=$HOME/.marks
+
+function jump { 
+    cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
+}
+
+function mark { 
+    mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
+}
+
+function unmark { 
+    rm -i "$MARKPATH/$1"
+}
+
+function marks {
+    ls -l "$MARKPATH" | sed 's/  / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
+}
diff --git a/.bash_shopt b/.bash_shopt
new file mode 100644 (file)
index 0000000..a13a6eb
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+# my weird shopt file
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+shopt -s globstar
+
+# automatically correct mistyped dir name when cd
+shopt -s cdspell 
+
+# correct dir spell errors on completion
+shopt -s dirspell
+
+shopt -s extglob # extended pattern matching features
+shopt -s cdspell # correct dir spelling errors on cd
+#shopt -s lithist # save multi-line commands with newlines
+shopt -s autocd # if a command is a dir name, cd to it
+shopt -s checkjobs # print warning if jobs are running on shell exit
+shopt -s dirspell # correct dir spelling errors on completion
+shopt -s globstar # ** matches all files, dirs and subdirs
+#shopt -s cmdhist # save multi-line commands in a single hist entry
+shopt -s checkwinsize # check the window size after each command
+shopt -s no_empty_cmd_completion # don't try to complete empty cmds
diff --git a/.bash_tmux b/.bash_tmux
new file mode 100644 (file)
index 0000000..07d144a
--- /dev/null
@@ -0,0 +1,207 @@
+# tmux completion by Fahd Shariff
+
+_tmux() {
+    # an array of commands and their options
+    declare -A tmux_cmd_map
+    tmux_cmd_map=( ["attach-session"]="-dr -t target-session" \
+                    ["bind-key"]="-cnr -t key-table key command arguments" \
+                    ["break-pane"]="-d -t target-pane" \
+                    ["capture-pane"]="-b buffer-index -E end-line -S start-line -t target-pane" \
+                    ["choose-buffer"]="-t target-window template" \
+                    ["choose-client"]="-t target-window template" \
+                    ["choose-session"]="-t target-window template" \
+                    ["choose-window"]="-t target-window template" \
+                    ["clear-history"]="-t target-pane" \
+                    ["clock-mode"]="-t target-pane" \
+                    ["command-prompt"]="-I inputs -p prompts -t target-client template" \
+                    ["confirm-before"]="-p prompt -t target-client command" \
+                    ["copy-mode"]="-u -t target-pane" \
+                    ["delete-buffer"]="-b buffer-index" \
+                    ["detach-client"]="-P -s target-session -t target-client" \
+                    ["display-message"]="-p -c target-client -t target-pane message" \
+                    ["display-panes"]="-t target-client" \
+                    ["find-window"]="-t target-window match-string" \
+                    ["has-session"]="-t target-session" \
+                    ["if-shell"]="shell-command command" \
+                    ["join-pane"]="-dhv -p percentage|-l size -s src-pane -t dst-pane" \
+                    ["kill-pane"]="-a -t target-pane" \
+                    ["kill-server"]="kill-server" \
+                    ["kill-session"]="-t target-session" \
+                    ["kill-window"]="-t target-window" \
+                    ["last-pane"]="-t target-window" \
+                    ["last-window"]="-t target-session" \
+                    ["link-window"]="-dk -s src-window -t dst-window" \
+                    ["list-buffers"]="list-buffers" \
+                    ["list-clients"]="-t target-session" \
+                    ["list-commands"]="list-commands" \
+                    ["list-keys"]="-t key-table" \
+                    ["list-panes"]="-as -t target" \
+                    ["list-sessions"]="list-sessions" \
+                    ["list-windows"]="-a -t target-session" \
+                    ["load-buffer"]="-b buffer-index path" \
+                    ["lock-client"]="-t target-client" \
+                    ["lock-server"]="lock-server" \
+                    ["lock-session"]="-t target-session" \
+                    ["move-window"]="-dk -s src-window -t dst-window" \
+                    ["new-session"]="-d -n window-name -s session-name -t target-session -x width -y height command" \
+                    ["new-window"]="-adk -n window-name -t target-window command" \
+                    ["next-layout"]="-t target-window" \
+                    ["next-window"]="-a -t target-session" \
+                    ["paste-buffer"]="-dr -s separator -b buffer-index -t target-pane" \
+                    ["pipe-pane"]="-t target-pane-o command" \
+                    ["previous-layout"]="-t target-window" \
+                    ["previous-window"]="-a -t target-session" \
+                    ["refresh-client"]="-t target-client" \
+                    ["rename-session"]="-t target-session new-name" \
+                    ["rename-window"]="-t target-window new-name" \
+                    ["resize-pane"]="-DLRU -t target-pane adjustment" \
+                    ["respawn-pane"]="-k -t target-pane command" \
+                    ["respawn-window"]="-k -t target-window command" \
+                    ["rotate-window"]="-DU -t target-window" \
+                    ["run-shell"]="command" \
+                    ["save-buffer"]="-a -b buffer-index" \
+                    ["select-layout"]="-np -t target-window layout-name" \
+                    ["select-pane"]="-lDLRU -t target-pane" \
+                    ["select-window"]="-lnp -t target-window" \
+                    ["send-keys"]="-t target-pane key " \
+                    ["send-prefix"]="-t target-pane" \
+                    ["server-info"]="server-info" \
+                    ["set-buffer"]="-b buffer-index data" \
+                    ["set-environment"]="-gru -t target-session name value" \
+                    ["set-option"]="-agsuw -t target-session|target-window option value" \
+                    ["set-window-option"]="-agu -t target-window option value" \
+                    ["show-buffer"]="-b buffer-index" \
+                    ["show-environment"]="-g -t target-session" \
+                    ["show-messages"]="-t target-client" \
+                    ["show-options"]="-gsw -t target-session|target-window" \
+                    ["show-window-options"]="-g -t target-window" \
+                    ["source-file"]="path" \
+                    ["split-window"]="-dhvP -p percentage|-l size -t target-pane command" \
+                    ["start-server"]="start-server" \
+                    ["suspend-client"]="-t target-client" \
+                    ["swap-pane"]="-dDU -s src-pane -t dst-pane" \
+                    ["swap-window"]="-d -s src-window -t dst-window" \
+                    ["switch-client"]="-lnp -c target-client -t target-session" \
+                    ["unbind-key"]="-acn -t key-table key" \
+                    ["unlink-window"]="-k -t target-window" )
+    
+   declare -A tmux_alias_map
+   tmux_alias_map=( ["attach"]="attach-session" \
+                    ["detach"]="detach-client" \
+                    ["has"]="has-session" \
+                    ["lsc"]="list-clients" \
+                    ["lscm"]="list-commands" \
+                    ["ls"]="list-sessions" \
+                    ["lockc"]="lock-client" \
+                    ["locks"]="lock-session" \
+                    ["new"]="new-session" \
+                    ["refresh"]="refresh-client" \
+                    ["rename"]="rename-session" \
+                    ["showmsgs"]="show-messages" \
+                    ["source"]="source-file" \
+                    ["start"]="start-server" \
+                    ["suspendc"]="suspend-client" \
+                    ["switchc"]="switch-client" \
+                    ["breakp"]="break-pane" \
+                    ["capturep"]="target-pane]" \
+                    ["displayp"]="display-panes" \
+                    ["findw"]="find-window" \
+                    ["joinp"]="join-pane" \
+                    ["killp"]="kill-pane" \
+                    ["killw"]="kill-window" \
+                    ["lastp"]="last-pane" \
+                    ["last"]="last-window" \
+                    ["linkw"]="link-window" \
+                    ["lsp"]="list-panes" \
+                    ["lsw"]="list-windows" \
+                    ["movew"]="move-window" \
+                    ["neww"]="new-window" \
+                    ["nextl"]="next-layout" \
+                    ["next"]="next-window" \
+                    ["pipep"]="pipe-pane" \
+                    ["prevl"]="previous-layout" \
+                    ["prev"]="previous-window" \
+                    ["renamew"]="rename-window" \
+                    ["resizep"]="resize-pane" \
+                    ["respawnp"]="respawn-pane" \
+                    ["respawnw"]="respawn-window" \
+                    ["rotatew"]="rotate-window" \
+                    ["selectl"]="select-layout" \
+                    ["selectp"]="select-pane" \
+                    ["selectw"]="select-window" \
+                    ["splitw"]="[shell-command]" \
+                    ["swapp"]="swap-pane" \
+                    ["swapw"]="swap-window" \
+                    ["unlinkw"]="unlink-window" \
+                    ["bind"]="bind-key" \
+                    ["lsk"]="list-keys" \
+                    ["send"]="send-keys" \
+                    ["unbind"]="unbind-key" \
+                    ["set"]="set-option" \
+                    ["setw"]="set-window-option" \
+                    ["show"]="show-options" \
+                    ["showw"]="show-window-options" \
+                    ["setenv"]="set-environment" \
+                    ["showenv"]="show-environment" \
+                    ["confirm"]="confirm-before" \
+                    ["display"]="display-message" \
+                    ["clearhist"]="clear-history" \
+                    ["deleteb"]="delete-buffer" \
+                    ["lsb"]="list-buffers" \
+                    ["loadb"]="load-buffer" \
+                    ["pasteb"]="paste-buffer" \
+                    ["saveb"]="save-buffer" \
+                    ["setb"]="set-buffer" \
+                    ["showb"]="show-buffer" \
+                    ["if"]="if-shell" \
+                    ["lock"]="lock-server" \
+                    ["run"]="run-shell" \
+                    ["info"]="server-info" )
+                    
+   local cur="${COMP_WORDS[COMP_CWORD]}"
+   local prev="${COMP_WORDS[COMP_CWORD-1]}"
+   COMPREPLY=()
+
+   # completing an option
+   if [[ "$cur" == -* ]]; then
+       #tmux options
+       if [[ "$prev" == "tmux" ]]; then
+           COMPREPLY=( $( compgen -W "-2 -8 -c -f -L -l -q -S -u -v -V" -- $cur ) )
+       else
+           #find the tmux command so that we can complete the options
+           local cmd="$prev"
+           local i=$COMP_CWORD
+           while [[ "$cmd" == -* ]]
+           do
+               cmd="${COMP_WORDS[i]}"
+               ((i--))
+           done
+           
+           #if it is an alias, look up what the alias maps to
+           local alias_cmd=${tmux_alias_map[$cmd]}
+           if [[ -n ${alias_cmd} ]]
+           then
+               cmd=${alias_cmd}
+           fi
+           
+           #now work out the options to this command
+           local opts=""           
+           for opt in ${tmux_cmd_map[$cmd]}
+           do
+                if [[ "$opt" == -* ]]; then
+                    len=${#opt}
+                    i=1
+                    while [ $i -lt $len ]; do
+                        opts="$opts -${opt:$i:1}"
+                        ((i++))
+                    done
+                fi
+           done
+           COMPREPLY=($(compgen -W "$opts" -- ${cur}))
+       fi
+   else
+       COMPREPLY=($(compgen -W "$(echo ${!tmux_cmd_map[@]} ${!tmux_alias_map[@]})" -- ${cur}))  
+   fi
+   return 0
+}
+complete -F _tmux tmux
diff --git a/.bashrc b/.bashrc
new file mode 100644 (file)
index 0000000..3fda6e4
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,124 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# because of vcprompt
+export PATH=$PATH:/home/nsukami/bin
+
+# If not running interactively, don't do anything
+case $- in
+    *i*) ;;
+    *) return;;
+esac
+
+
+# make less more friendly for non-text input files, see lesspipe(1)
+#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
+    debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+    xterm-color) color_prompt=yes;;
+esac
+
+# uncomment for a colored prompt, if the terminal has the capability; turned
+# off by default to not distract the user: the focus in a terminal window
+# should be on the output of commands, not on the prompt
+force_color_prompt=yes
+
+if [ -n "$force_color_prompt" ]; then
+    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+       # We have color support; assume it's compliant with Ecma-48
+       # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+       # a case would tend to support setf rather than setaf.)
+       color_prompt=yes
+    else
+       color_prompt=
+    fi
+fi
+
+# export command for coloring
+# '\e[x;ym $PS1 \e[m' or [\033[x;ym\] $PS1 [\033[00m\] x;y being the color pair to use
+
+# why I am doing this?
+if [ "$color_prompt" = yes ]; then
+    if [ $USER='nsukami' ]; then
+       PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]k\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] > '
+    else
+       PS1='${debian_chroot:+($debian_chroot)}\u@\[\033[31m\]\h\[\033[00m\]:\w \[\033[1;33m\]$(vcprompt -f %b%a%m%u)\[\033[0m\] > '
+    fi
+else
+    if [ $USER='nsukami']; then
+        PS1='${debian_chroot:+($debian_chroot)}5@\[\033[31m\]k\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) > '
+    else
+       PS1='${debian_chroot:+($debian_chroot)}\u@\[\033[31m\]\h\[\033[00m\]:\w $(vcprompt -f %b%a%m%u) > '
+    fi
+
+fi
+
+unset color_prompt force_color_prompt
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+    xterm*|rxvt*)
+       PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w $(vcprompt -f %b%a%m%u) \a\]$PS1"
+       ;;
+    *)
+       ;;
+esac
+
+# enable color support of ls
+if [ -x /usr/bin/dircolors ]; then
+    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+    alias ls='ls --color=auto'
+fi
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if ! shopt -oq posix; then
+    if [ -f /usr/share/bash-completion/bash_completion ]; then
+       . /usr/share/bash-completion/bash_completion
+    elif [ -f /etc/bash_completion ]; then
+       . /etc/bash_completion
+    fi
+fi
+
+
+# Alias definitions.
+[[ -f ~/.bash_aliases ]] && . ~/.bash_aliases
+
+# personal customization
+[[ -f ~/.bash_customization ]] && . ~/.bash_customization
+
+# personal functions
+[[ -f ~/.bash_function ]] && . ~/.bash_function
+
+# personal export
+[[ -f ~/.bash_export ]] && . ~/.bash_export
+
+# personal color
+[[ -f ~/.bash_color ]] && . ~/.bash_color
+
+# personal shopt
+[[ -f ~/.bash_shopt ]] && . ~/.bash_shopt
+
+# git completion
+[[ -f ~/.git_completion ]] && . ~/.git_completion
+
+# is or is not
+[[ -f ~/.bash_is ]] && . ~/.bash_is
+
+# jump to directories
+[[ -f ~/.bash_marks ]] && . ~/.bash_marks
+
+# tmux completion script
+[[ -f ~/.bash_tmux ]] && . ~/.bash_tmux
+
+# completions script
+[[ -f ~/.bash_compl ]] && . ~/.bash_compl
+
diff --git a/.tmux.conf b/.tmux.conf
new file mode 100644 (file)
index 0000000..147445f
--- /dev/null
@@ -0,0 +1,85 @@
+
+# how to send tmux commands to nested tmux session
+set -g prefix C-b
+unbind C-a
+bind C-b send-prefix
+
+# utf8 support
+set-window-option -g utf8 on
+
+# bind kill-session to C-b k
+bind k kill-session
+
+# windows starts at 1
+set -g base-index 1
+
+# Sane scrolling
+set -g terminal-overrides 'xterm*:smcup@:rmcup@'
+
+# intuitive splitting
+bind | split-window -h
+bind - split-window -v
+bind _ split-window -v
+
+#------------------------------------------------------------------------------
+#   STATUSBAR
+#------------------------------------------------------------------------------
+
+# default statusbar colors
+set -g status-fg white
+set -g status-bg blue
+set -g status-attr dim
+
+# Left side of status bar
+set -g status-left-length 20
+#set -g status-left '#[fg=green][#[bg=black,fg=cyan]#S#[bg=black,fg=blue,dim]:#H#[fg=green]]'
+
+# Right side of status bar
+set -g status-right-length 100
+set -g status-right ' #[fg=red]| #[fg=white]#T #[fg=red]| #[fg=yellow]%d %h - %H:%M #[default]'
+
+# Example of using a shell command in the status line
+#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
+#set -g status-right ' #[fg=red] | #[fg=white] #T #[fg=red] | #[fg=yellow] #(date) %H:%M #[default] #[fg=red] |'
+
+# Inactive windows in status bar
+set-window-option -g window-status-format '#[fg=cyan,dim]#I#[fg=blue]:#[default]#W#[fg=grey,dim]#F'
+
+# Current or active window in status bar
+#set-window-option -g window-status-current-bg yellow
+#set-window-option -g window-status-current-fg black
+set-window-option -g window-status-current-format '#[bg=blue,fg=cyan,bold]#I#[bg=blue,fg=cyan]:#[fg=white]#W#[fg=dim]#F'
+
+#---------------------
+# ACTIVITY MONITORING
+#---------------------
+
+#set- -g monitor-activity on
+#set -g visual-activity on
+
+
+# Highlight active window
+#set-window-option -g window-status-current-bg red
+
+#----------------
+# CUSTOMIZATION
+#----------------
+
+#reload this file
+bind R source-file ~/.tmux.conf \; display-message "tmux configuration reloaded!"
+
+# launch ssh in another window
+bind S command-prompt -p "ssh" "new-window -n ssh:%1 'exec ssh %1'"
+
+# call man of command on another panel
+bind H command-prompt -p "man" "split-window -h 'exec man %1'"
+
+# open irc in another window
+bind M-c new-window -n irc \; \
+     send-keys -t :irc 'irssi -c irc.freenode.net -n patricknsukami -w patrick/nsukami' C-m \; \
+     select-window -t :irc
+
+# open postgresql on another window
+bind M-d new-window -n psql \; \
+     send-keys -t :psql 'psql -d template1' C-m \; \
+     select-window -t :psql