병홍 2013. 2. 13. 17:05

# base-files version 4.9-3

# To pick up the latest recommended .bashrc content,
# look in /etc/defaults/etc/skel/.bashrc

# Modifying /etc/skel/.bashrc directly will prevent
# setup from updating it.

# The copy in your home directory (~/.bashrc) is yours, please
# feel free to customise it to create a shell
# environment to your liking.  If you feel a change
# would be benificial to all, please feel free to send
# a patch to the cygwin mailing list.

# User dependent .bashrc file

# Environment Variables
# #####################

# TMP and TEMP are defined in the Windows environment.  Leaving
# them set to the default Windows temporary directory can have
# unexpected consequences.
unset TMP
unset TEMP

# Alternatively, set them to the Cygwin temporary directory
# or to any other tmp directory of your choice
# export TMP=/tmp
# export TEMP=/tmp

# Or use TMPDIR instead
# export TMPDIR=/tmp

# Shell Options
# #############

# See man bash for more options...

# Don't wait for job termination notification
# set -o notify

# Don't use ^D to exit
# set -o ignoreeof

# Use case-insensitive filename globbing
shopt -s nocaseglob

# Make bash append rather than overwrite the history on disk
shopt -s histappend

# When changing directory small typos can be ignored by bash
# for example, cd /vr/lgo/apaache would find /var/log/apache
# shopt -s cdspell


# Completion options
# ##################

# These completion tuning parameters change the default behavior of bash_completion:

# Define to access remotely checked-out files over passwordless ssh for CVS
# COMP_CVS_REMOTE=1

# Define to avoid stripping description in --option=description of './configure --help'
# COMP_CONFIGURE_HINTS=1

# Define to avoid flattening internal contents of tar files
COMP_TAR_INTERNAL_PATHS=1

# If this shell is interactive, turn on programmable completion enhancements.
# Any completions you add in ~/.bash_completion are sourced last.
case $- in
  *i*) [[ -f /etc/bash_completion ]] && . /etc/bash_completion ;;
esac


# History Options
# ###############

# Don't put duplicate lines in the history.
# export HISTCONTROL="ignoredups"

# Ignore some controlling instructions
# HISTIGNORE is a colon-delimited list of patterns which should be excluded.
# The '&' is a special pattern which suppresses duplicate entries.
# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit'
# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:ls' # Ignore the ls command as well

# Whenever displaying the prompt, write the previous line to disk
# export PROMPT_COMMAND="history -a"


# Aliases
# #######

# Some example alias instructions
# If these are enabled they will be used instead of any instructions
# they may mask.  For example, alias rm='rm -i' will mask the rm
# application.  To override the alias instruction use a \ before, ie
# \rm will call the real rm not the alias.

# Interactive operation...
# alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Default to human readable figures
# alias df='df -h'
# alias du='du -h'

# Misc :)
# alias less='less -r'                          # raw control characters
# alias whence='type -a'                        # where, of a sort
alias grep='grep --color'                     # show differences in colour

# Some shortcuts for different directory listings
alias ls='ls -hF --color=tty'                 # classify files in colour
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
alias ll='ls -l'                              # long list
alias la='ls -A'                              # all but . and ..
# alias l='ls -CF'                              #
alias lr='ls -R'


# Functions
# #########

# Some example functions
function settitle() { echo -ne "\e]2;$@\a\e]1;$@\a"; }

 

# by hojin

shopt -s checkwinsize
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\!:\[\033[01;34m\]\w\[\033[00m\]\$ '
ANDROID_ROOT="${HOME}/src/cappuccino2.3"
ANDROID_SDK_ROOT="/cygdrive/d/LiberKey/MyApps/android-sdk-windows"

export LESS="-FWXQi"

alias psg='ps ax | grep'
alias d='popd'
alias ..='cd ..'
alias ...='cd .. ; builtin cd ..'
alias ....='cd .. ; builtin cd .. ; builtin cd ..'
alias .....='cd .. ; builtin cd .. ; builtin cd .. ; builtin cd ..'

unalias l 2>/dev/null
l () {
    if [[ -f /dev/stdin || -p /dev/stdin ]]
    then
        less </dev/stdin
        return
    fi

    local JJ FILEARG MORETHANONEFILEARG
    for JJ in "$@"
    do
        if [[ ${JJ:0:1} != "-" ]]
        then
            MORETHANONEFILEARG=${FILEARG:+true}    #FILEARG媛€ ?덉쑝硫?true ?놁쑝硫?null
            FILEARG=${JJ}
        fi
    done
    #echo "F=${FILEARG}"
    #echo "M=${MORETHANONEFILEARG}"

    # ls瑜??ㅽ뻾?섎뒗 寃쎌슦
    # 1. ?듭뀡???꾨땶 ?몄옄媛€ ?놁쓬
    # 2. ?듭뀡???꾨땶 ?몄옄媛€ ???댁긽
    # 3. ?듭뀡???꾨땶 ?몄옄媛€ ???섎굹?닿퀬, 洹멸쾶 ?붾젆?좊━
    # less ?ㅽ뻾?섎뒗 寃쎌슦
    # 1. ?듭뀡???꾨땶 ?몄옄媛€ ???섎굹?닿퀬, 洹멸쾶 ?붾젆?좊━ ?꾨떂
    # 2. ?쒖??낅젰???덉쓬 (?꾩뿉??泥섎━)
    if [[ -z ${FILEARG} || -n ${MORETHANONEFILEARG} || -d "${FILEARG}" ]]
    then
        ls "$@"
    else
        less "$@"
    fi
}

unalias cd 2>/dev/null
cd () {
    if [[ $# -eq 0 ]]
    then
        dirs -c
        builtin cd
    else
        pushd "${@:-${HOME}}" >/dev/null
    fi
}

# cygwin?먯꽌留?異붽????댁슜
# unalias e 2>/dev/null
# function e()
# {
#     "/cygdrive/c/Program Files/Vim/vim73/gvim.exe" $(cygpath -wi $*)
# }

# android ?뚯뒪肄붾뱶 ?ы븿??ctags
unalias actags 2>/dev/null
function actags()
{
    ctags "$@"
    ctags -aR $(cygpath -w ${ANDROID_ROOT:-${HOME}/src/cappuccino2.3}/cappuccino/frameworks/base/core/java/)
    ctags -aR $(cygpath -w ${ANDROID_ROOT:-${HOME}/src/cappuccino2.3}/frameworks/base/*/java/)
    ctags -aR $(cygpath -w ${ANDROID_ROOT:-${HOME}/src}/frameworks/base/*/java/)
    ctags -aR $(cygpath -w ${ANDROID_SDK_ROOT:-/cygdrive/d/LiberKey/MyApps/android-sdk-windows}/extras/android/compatibility/v4/src/){java,honeycomb}
}

# ?붾젆?좊━ 李얠븘?ㅼ뼱媛€湲?洹€李?떎!
unalias fcd 2>/dev/null
function fcd()
{
    cd $(find -type d -name ${1} | grep '^' || find -type d -name ${1}* | grep '^' || echo '.')
}

# texlive ?ㅼ튂?섎땲 tetex ?섍꼍蹂€?섎뒗 ?놁븷?쇰꽕
export TEXDOCVIEW_dvi=
export TEXDOCVIEW_html=
export TEXDOCVIEW_pdf=
export TEXDOCVIEW_ps=
export TEXDOCVIEW_txt=
export PATH=/usr/local/texlive/2010/bin/i386-cygwin/:${PATH}
export LANG=en_KR.UTF-8

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=5000
HISTFILESIZE=10000

export LANG=ko_KR.UTF-8