Mercurial > hg > config
diff .bashrc @ 71:3d111401010f
add a function to view the files in a diff
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 26 May 2010 10:15:35 -0700 |
parents | a791d862148c |
children | 84ffa220796a |
line wrap: on
line diff
--- a/.bashrc Fri May 21 15:40:46 2010 -0700 +++ b/.bashrc Wed May 26 10:15:35 2010 -0700 @@ -43,12 +43,14 @@ # functions cdwin() { +# change directory to a window's location using its title DIR=$(xwininfo | dictify.py xwininfo | awk '{ print $NF }' | sed 's/"//g') DIR=${DIR/\~/$HOME} cd $DIR } eend() { +# edit the end of a file with emacs FILE=$1 shift emacs +`wc -l "$FILE"` $@ @@ -167,6 +169,7 @@ } swap() { +# swap two files if [ "$#" != "2" ] then echo "Usage: $FUNCNAME <first_arg> <second_arg>" @@ -195,6 +198,7 @@ } isrunning() { +# is a process running? (by name) for i in "$@" do ps axwww | grep "$i" | grep -v 'grep' @@ -203,6 +207,7 @@ } killbyname() { +# kill a process by name kill `isrunning "$@" | awk '{ print $1 }' | onelineit.py` } @@ -232,10 +237,12 @@ } pyfile() { +# python file name python -c "import $1; print $1.__file__" } svndance(){ +# do the svn import dance! if (( $# )) then svn import $1 @@ -248,6 +255,10 @@ fi } +difffiles() { +grep '^+++ ' $@ | sed 's/+++ b\///' +} + ### include overrides for commands source ~/.bash_overrides