Commit 28a02f23 by PotatoGim

bashrc: update 'cd' wrapper and comments

parent 11a202fb
......@@ -9,15 +9,12 @@
#
############################################################################
#---------------------------------------------------------------------------
# Functions
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# Description : Make tags using ctags with C sources
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at :
# Parameters : none
#--- FUNCTION ------------------------------------------------------------
# NAME: mkktags
# DESCRIPTION: Make tags using ctags with C sources
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
#---------------------------------------------------------------------------
function mkctags
{
......@@ -34,11 +31,13 @@ function mkctags
cscope -i cscope.files
}
#---------------------------------------------------------------------------
# Description : Make tags using ctags with Linux Kernel sources
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at : 2015년 01월 13일 15:07
# Parameters :
#--- FUNCTION ------------------------------------------------------------
# NAME: mkktags
# DESCRIPTION: Make tags using ctags with Linux Kernel sources
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
# DATE: 2015년 01월 13일 15:07
#---------------------------------------------------------------------------
function mkktags
{
......@@ -64,11 +63,12 @@ function mkktags
cscope -b -q -k -k -i cscope.files
}
#---------------------------------------------------------------------------
# Description : Make tags using ctags with C++ sources
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at :
# Parameters : none
#--- FUNCTION ------------------------------------------------------------
# NAME: mkperltags
# DESCRIPTION: Make tags using ctags with C++ sources
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
#---------------------------------------------------------------------------
function mkcpptags
{
......@@ -92,11 +92,12 @@ function mkcpptags
cscope -i cscope.files
}
#---------------------------------------------------------------------------
# Description : Make tags using ctags with perl sources
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at :
# Parameters : none
#--- FUNCTION ------------------------------------------------------------
# NAME: mkperltags
# DESCRIPTION: Make tags using ctags with perl sources
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
#---------------------------------------------------------------------------
function mkperltags
{
......@@ -113,12 +114,12 @@ function mkperltags
cscope -b -q -i cscope.files
}
#---------------------------------------------------------------------------
# Description : Make tags using ctags with default headers
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at :
# Parameters : none
#--- FUNCTION ------------------------------------------------------------
# NAME: mkgtags
# DESCRIPTION: Make global tags using ctags with default headers
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
#---------------------------------------------------------------------------
function mkgtags
{
......@@ -128,22 +129,25 @@ function mkgtags
--recurse -f${HOME}/.ctags/boost /usr/include/boost
}
#---------------------------------------------------------------------------
# Description : Run vmplayer
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at :
# Parameters : none
#--- FUNCTION ------------------------------------------------------------
# NAME: pg_runvnc
# DESCRIPTION: Run VMware a virtual machine.
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
#---------------------------------------------------------------------------
function pg_runvm
{
vmrun -T player start "/mnt/potatovm/Windows\ 7\ x64/Windows\ 7\ x64.vmx" nogui
}
#---------------------------------------------------------------------------
# Description : Run x11vnc
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at :
# Parameters : none
#--- FUNCTION ------------------------------------------------------------
# NAME: pg_runvnc
# DESCRIPTION: Run x11vnc as a server
# PARAMETERS: ---
# RETURNS: ---
# NOTES: ---
# DATE: Tue Aug 27 08:09:28 UTC 2013
#---------------------------------------------------------------------------
function pg_runvnc
{
......@@ -151,13 +155,15 @@ function pg_runvnc
-solid red -ncache 10 -o ~/.vnc/log -bg &
}
#---------------------------------------------------------------------------
# Description : Rename VM on VMware ESXi Server
# Authors : Gim Ji-Hyeon <potatogim@potatogim.net>
# Written at : Tue Aug 27 08:09:28 UTC 2013
# Parameters :
# $1 : from
# $2 : to
#--- FUNCTION ------------------------------------------------------------
# NAME: tmux_rename
# DESCRIPTION: Rename VM on VMware ESXi Server
# PARAMETERS: ---
# $1 : from
# $2 : to
# RETURNS: ---
# NOTES: ---
# DATE: Tue Aug 27 08:09:28 UTC 2013
#---------------------------------------------------------------------------
function pg_renamevm
{
......@@ -188,6 +194,38 @@ function pg_renamevm
| xargs sed -ie "s/$from/$to/g"
}
#--- FUNCTION ------------------------------------------------------------
# NAME: cd
# DESCRIPTION: wrapper for change directory(cd).
# PARAMETERS: ---
# $1 : Directory path
# RETURNS: ---
#---------------------------------------------------------------------------
function cd()
{
builtin cd "$@";
if [[ "x$TMUX" != "x" ]]; then
svn info 1>/dev/null 2>&1
if [[ $? -eq 0 ]]; then
REPO=`svn info | grep "^URL" | perl -pe "s/^URL: \w+:\/\/[^\/]+//;"`;
tmux rename-window "[SVN] $REPO";
return;
fi
git remote -v 1>/dev/null 2>&1
if [[ $? -eq 0 ]]; then
REPO=`git remote -v | grep -E "^origin.+(push)" | perl -pe "s/^origin\s+(?:\w+:\/\/[^\/]+|.+:)([^\s]+).*/\1/;"`;
tmux rename-window "[GIT] $REPO";
return;
fi
tmux rename-window "${PWD/#${HOME}/~}";
fi;
}
############################################################################
#
......@@ -224,15 +262,6 @@ alias rm="rm -i"
alias vi="vim"
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
function cd()
{
builtin cd "$@";
if [[ "x$TMUX" != "x" ]]; then
tmux rename-window "${PWD/#${HOME}/~}";
fi;
}
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment