]> git.phdru.name Git - dotfiles.git/blob - .profile
.profile: remove PROMPT_COMMAND, set titles from PS1
[dotfiles.git] / .profile
1 #
2 # $HOME/.profile (works with sh, ksh and bash)
3 #
4
5 case "$SHELL" in
6    */*csh) SHELL=/bin/bash
7    ;;
8    # this is for bash.exe
9    *command.com | \
10       *\\bash) SHELL=//c/ubin/bash
11    ;;
12 esac
13
14 if [ -z "$USER" ]; then
15    USER="$LOGNAME"; export USER
16 fi
17
18 ### umask sets a mask for the default file permissions,
19 ### umask 022 is less restrictive, 077 more paranoid
20 umask 077
21
22 PATH="$HOME"/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
23 MANPATH="$HOME"/man:/usr/local/man:/usr/share/man:/usr/man
24 # LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
25 export PATH MANPATH # LD_LIBRARY_PATH
26
27 LANG=C
28 #LC_ALL=C
29 case "$LC_CTYPE" in
30    *UTF-8) # LC_CTYPE is already set
31    ;;
32
33    *) LC_CTYPE=ru_RU.KOI8-R
34    ;;
35 esac
36 LC_COLLATE="$LC_CTYPE"
37 #LANGUAGE="ru en"
38 export LANG LC_CTYPE LC_COLLATE
39 unset LC_ALL LANGUAGE
40
41 # Default for df/du
42 BLOCKSIZE=1k
43 export BLOCKSIZE
44
45 ### uncomment to select an alternate timezone (/etc/localtime is default)
46 # TZ=/usr/share/zoneinfo/Europe/Moscow; export TZ
47
48 ### NEWS Configuration
49 ORGANIZATION=Home
50 # NNTPSERVER=news
51 export ORGANIZATION # NNTPSERVER
52
53 (set -P 2>/dev/null) && set -P # follow physical paths, not symlinks
54
55 # Interactive only commands
56 if [ -t 0 ] ; then
57    if [ -z "$TERM" ]; then
58       eval `tset -Q -s -m 'network:?xterm'`
59    fi
60
61    stty sane erase ^H
62
63    case "$TERM" in
64       linux)
65          # mutt, python and vim
66          BACKGROUND=DARK
67          export BACKGROUND
68          . "$HOME"/lib/config/less/dark_bg
69       ;;
70
71       *rxvt*|screen*|*term*|vt100)
72          BACKGROUND=LIGHT
73          export BACKGROUND
74          . "$HOME"/lib/config/less/light_bg
75       ;;
76    esac
77
78    if [ -x /usr/bin/dircolors ]; then
79        test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
80    fi
81
82    PAGER=less
83    LESS="FRXgimq"
84    case "$LC_CTYPE" in
85       *UTF-8) LESSCHARSET=utf-8
86       ;;
87
88       *) LESSCHARSET=koi8-r
89       ;;
90    esac
91    #LESSCHARDEF=32c.
92    LESSEDIT='vim ?lt+%lt. -- %f'
93    export PAGER LESS LESSCHARSET LESSEDIT # LESSCHARDEF
94
95    EDITOR="$HOME"/.vim/vim.sh
96    VISUAL="$EDITOR"
97    FCEDIT="$EDITOR"
98    export EDITOR VISUAL FCEDIT
99
100    HISTCONTROL=ignoreboth
101    HISTIGNORE='&: *:x:X:[bf]g'
102    HISTFILE="$HOME/.sh_history"
103    HISTFILESIZE=1000
104    HISTSIZE=1000
105    export HISTCONTROL HISTIGNORE HISTFILE HISTFILESIZE HISTSIZE
106
107    # Used by bash/mc for hostname completion
108    HOSTFILE="$HOME"/lib/config/hosts
109    export HOSTFILE
110
111    MAIL="/var/mail/$USER"
112    MAILPATH="$MAIL:$HOME/mail/admin:$HOME/mail/block:$HOME/mail/bulk"
113    if [ -d "$HOME"/mail/lists/ ]; then
114          MAILPATH="$MAILPATH:`echo $HOME/mail/lists/* | sed 's/ /:/g'`"
115    fi
116    export MAIL MAILPATH
117
118    BROWSER="links2:links:elinks:w3m:lynx"
119    case "$TERM" in
120       *rxvt*|screen*|*term*|vt100)
121          BROWSER="l:$BROWSER"
122       ;;
123    esac
124    export BROWSER
125
126    #all_proxy="http://localhost:3128"
127    #ftp_proxy="$all_proxy"
128    #gopher_proxy="$all_proxy"
129    #http_proxy="$all_proxy"
130    #https_proxy="$all_proxy"
131    auto_proxy="file:///home/phd/admin/WWW/Mozilla/mozilla.pac"
132    no_proxy="localhost,127.0.0.1"
133    #export all_proxy ftp_proxy http_proxy https_proxy auto_proxy no_proxy # gopher_proxy
134    export auto_proxy no_proxy
135
136    ENV="$HOME/.shellrc"
137    export ENV
138
139    case "$SHELL" in
140       */bash)
141          shopt -s checkwinsize
142          # display the user, host and current working directory
143          # in the terminal title
144          case "$TERM" in
145             *rxvt*|screen*|*term*|vt100)
146                OPS1="\[\033]0;\u@\h:\w\007\]"
147                case "$TERM" in
148                   screen*)
149                      OPS1+"\[\033k\u@\h:\w\033\\\]" # Set screen/tmux caption
150                   ;;
151                esac
152             ;;
153
154             *)
155                OPS1=""
156             ;;
157          esac
158
159          OPS1+="\u@\h \W "
160          . "$ENV"
161          ;;
162       *)
163          OPS1="`/usr/bin/whoami`@`/bin/hostname -s` "
164          ;;
165    esac
166
167    #PROMPT_DIRTRIM=2
168    export OPS1 # PROMPT_DIRTRIM
169
170    ### biff controls new mail notification
171    #biff n
172    ### mesg controls messages (write/talk) from other users
173    mesg n
174    # make mail(1) use a pager
175    crt=; export crt
176
177    PYTHONSTARTUP="$HOME"/lib/python/init.py
178    export PYTHONSTARTUP
179
180    name="Oleg Broytman"
181    email="phd@phdru.name"
182
183    GIT_AUTHOR_NAME="$name"
184    GIT_AUTHOR_EMAIL="$email"
185    GIT_COMMITTER_NAME="$name"
186    GIT_COMMITTER_EMAIL="$email"
187    export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
188
189    HGUSER="$name <$email>"
190    export HGUSER
191
192    unset name email
193
194    if test -f .hushlogin && ! cmp -s .motd /etc/motd; then
195       tee $HOME/.motd < /etc/motd
196    fi
197 fi
198
199 # No need to set DISPLAY - ssh sets DISPLAY and calls xauth
200 #DISPLAY="`who am i | awk '{print substr($6, 2, length($6)-2 )}' | sed -e 's/:.*$//'`:0.0"
201 #export DISPLAY
202
203 if [ -n "$DISPLAY" ]; then
204    # mutt, python and vim
205    BACKGROUND=LIGHT
206    export BACKGROUND
207    . "$HOME"/lib/config/less/light_bg
208
209    # BROWSERs
210    BROWSER="firefox:seamonkey:chromium:google-chrome:opera:xlinks2:$BROWSER"
211
212    ### X Window System Configuration
213    #XAPPLRESDIR="$HOME/lib/X11/app-defaults/"; export XAPPLRESDIR
214    ### Old-style XNLSPATH
215    #XNLSPATH=/usr/X11R6/lib/X11/nls; export XNLSPATH
216
217    # For GTK2/GLib to convert filenames between internal and locale encodings
218    G_FILENAME_ENCODING="@locale"
219    export G_FILENAME_ENCODING
220    #G_BROKEN_FILENAMES=1
221    #export G_BROKEN_FILENAMES
222
223    # X Input Method, for Multi key (Compose) to work
224    GTK_IM_MODULE=xim
225    QT_IM_MODULE=xim
226    export GTK_IM_MODULE QT_IM_MODULE
227
228    # GTK2 anti-aliasing
229    GDK_USE_XFT=1
230    export GDK_USE_XFT
231
232    # nVidia OpenGL full scene anti-aliasing
233    #__GL_FSAA_MODE=4
234    #export __GL_FSAA_MODE
235 fi
236
237 #
238 # read in usepkg function
239 # . "$HOME"/lib/config/usepkg.sh
240 #
241
242 #
243 # usepkg gnu
244 #
245
246 #
247 # If SUN console, start the windows system
248 #
249 # if [ `tty` = /dev/console ] ; then
250 #    if [ "$TERM" = sun -o "$TERM" = AT386 ] ; then
251 #
252 #       if [ ${OPENWINHOME:-""} = "" ] ; then
253 #          OPENWINHOME=/usr/openwin
254 #          export OPENWINHOME
255 #       fi
256 #
257 #       echo ""
258 #       echo "Starting OpenWindows in 5 seconds (type Control-C to interrupt)"
259 #       sleep 5
260 #
261 #       "$OPENWINHOME"/bin/openwin
262 #
263 #       clear      # get rid of annoying cursor rectangle
264 #       #exit      # logout after leaving windows system
265 #
266 #    fi
267 # fi