root/lang/perl/Dist-Joseki/trunk/tools/dotfiles/.bashrc @ 9773

Revision 9773, 3.6 kB (checked in by hanekomu, 6 years ago)

r6111@nbgr: marcel | 2008-04-18 16:36:49 +0200
lang/perl/Dist-Joseki: initial commit

Line 
1# If not running interactively, then exit
2if [ -n "$PS1" ]; then
3
4test -f ~/.bashrc_site_before && source ~/.bashrc_site_before
5test -f /sw/bin/init.sh && . /sw/bin/init.sh
6source ~/.aliases
7
8# speeding up text selection: The colon is a no-op for the Bourne family
9# of shells. So just select whole lines and paste; with conventional
10# prompts you have to be careful not to select the prompt as well.
11
12set_prompt () {
13    export PS1=": \u@\h \W; "
14    export PS2=":; "
15}
16
17# append commands from all terminals into the history file immediately
18shopt -s histappend
19PROMPT_COMMAND='history -a'
20
21stty sane 2>/dev/null
22stty erase ^?
23umask 022
24
25IGNORE_EOF=1
26
27export LESSCHARSET=iso8859
28export EDITOR=/usr/bin/vim
29export CVSEDITOR=/usr/bin/vim
30export CVS_RSH=ssh
31export PAGER=less
32export TEST_MODE=1
33#export LC_COLLATE=C
34export DISPLAY=:0.0
35export TEST_AUTHOR=1
36export PROJROOT
37export PTAGSFILE=~/.ptags
38# for iTerm:
39export TERM=linux
40
41export CPPFLAGS
42for d in /{sw,usr/local}/include
43do
44    test -d $d && CPPFLAGS="-I$d $CPPFLAGS"
45done
46
47export LDFLAGS
48for d in /{sw,usr/local}/lib
49do
50    test -d $d && LDFLAGS="-L$d $LDFLAGS"
51done
52
53# remove domain name from hostname, if domain name
54# is in hostname (otherwise, just hostname).
55export HOSTNAME=`hostname | sed s/\\\..\*//g`
56
57export PATH
58export MANPATH
59for d in /usr /{usr,opt}/{local,share,local/share,local/pgsql,git,git/share} ~{,/home,/perl}
60do
61    test -d $d/bin && PATH=$d/bin:$PATH
62    test -d $d/man && MANPATH=$d/man:$MANPATH
63done
64
65TESTPATH=/usr/local/teTeX/bin/i386-apple-darwin-current
66test -d $TESTPATH && PATH=$TESTPATH:$PATH
67
68LESSPIPE=`which lesspipe.sh`
69[[ $LESSPIPE ]] && export LESSOPEN="|$LESSPIPE %s"
70
71IGNOREEOF=1  # so first ^D doesn't logout, second ^D does
72
73cd () {
74    builtin cd "$*"
75    ls --color=auto
76}
77
78(which ncftp >/dev/null) && alias ftp=ncftp
79
80
81# vim: If args are given, open those files. If no arg is given, use
82# viminfo to jump to last known cursor position
83
84vi () { /usr/bin/vim ${@:- -c "normal '0"}; }
85
86# perl module development
87cdpm () { cd $(dirname $(pmpath $1)); }
88
89pver () {
90    perl -MCPAN -e"print CPAN::Shell->format_result(q{Module}, q{$1})"
91}
92
93# so you can do
94#   vit Foo::Bar::Baz
95# to edit the class
96#   cdt Foo::Bar::Baz
97# to cd to the class's directory, we use vim tags.
98# We also have custom completion rules for cdt and vit in
99# .bash_completion.
100
101cdt () { cd `cdt.pl $1`; }
102
103
104targets () { perl -ne 'print "$1\n" if /^(\w+):/' Makefile; }
105
106# Check for recent enough version of bash.
107bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
108
109# Check for interactive shell.
110if [ -n "$PS1" ]; then
111  if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
112    if [ -r /etc/bash_completion ]; then
113      # Source completion code.
114    . /etc/bash_completion/bash_completion
115    . /etc/bash_completion/contrib/svk
116    fi
117  fi
118fi
119unset bash bminor bmajor
120
121
122# list all instances of one or more files found within the $PATH.
123
124wh () {
125    perl -MFile::Which -e'
126        for $file (@ARGV) {
127            print "$_\n" for grep { !$seen{$_}++ } which($file)
128        }
129    ' $*;
130}
131
132projptags () {
133    rm -f $PTAGSFILE
134    ptags $* --use $PROJROOT --exclude ~/.ptags_exclude >>$PTAGSFILE
135
136    if [ -f $PTAGS_DYNAMIC ]; then
137        echo Generating dynamic ptags
138        $PTAGS_DYNAMIC >>$PTAGSFILE
139    fi
140
141    sort -o $PTAGSFILE $PTAGSFILE
142}
143
144
145ORIGPATH=$PATH
146
147set_project () {
148    export PROJROOT=$1
149    export PERL5OPT="-MDevel::SearchINC::FindLib=$PROJROOT"
150    export CF_CONF=local
151
152    PATH=$ORIGPATH
153    for i in $(distfind)
154    do
155        if [ -d $i/bin ]; then
156            PATH=$i/bin:$PATH
157        fi
158    done
159}
160
161
162set_prompt
163test -f ~/.bashrc_site_after && . ~/.bashrc_site_after
164
165fi
Note: See TracBrowser for help on using the browser.